2013-08-17 14:51:50 |
Augusto Santos |
description |
On __Init__.py, on the end of the file, there is a print function that is not compatible with Python 3. While it should, mostly, not be executed, the error is still there:
if __name__ == '__main__':
import sys
soup = BeautifulSoup(sys.stdin)
print soup.prettify() |
BS4 is not compatible with Python 3.3.
First there are some problems with print usage (like on the end of __init__.py)
if __name__ == '__main__':
import sys
soup = BeautifulSoup(sys.stdin)
print soup.prettify()
Tried running 2to3 on it and still got the following error
Traceback (most recent call last):
File "C:\Users\AntonioAugusto\Google Drive\Migrado Dropbox\Game Searcher - Shell\busca_jogos.py", line 537, in <module>
main()
File "C:\Users\AntonioAugusto\Google Drive\Migrado Dropbox\Game Searcher - Shell\busca_jogos.py", line 510, in main
print(getCotacao())
File "C:\Users\AntonioAugusto\Google Drive\Migrado Dropbox\Game Searcher - Shell\busca_jogos.py", line 40, in getCotacao
soup = bs4.BeautifulSoup(page)
File "C:\Python33\lib\site-packages\bs4\__init__.py", line 169, in __init__
self.builder.prepare_markup(markup, from_encoding))
File "C:\Python33\lib\site-packages\bs4\builder\_htmlparser.py", line 141, in prepare_markup
dammit = UnicodeDammit(markup, try_encodings, is_html=True)
File "C:\Python33\lib\site-packages\bs4\dammit.py", line 228, in __init__
self._detectEncoding(markup, is_html)
File "C:\Python33\lib\site-packages\bs4\dammit.py", line 397, in _detectEncoding
xml_encoding_match = xml_encoding_re.match(xml_data)
TypeError: expected string or buffer
Running Python 3.3.2 64 on Windows 8
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AM
D64)] on win32 |
|