Python 3.1.1 reporting SyntaxErrors in BeautifulSoup.py 3.1.0.1

34 views
Skip to first unread message

Drew Tronvig

unread,
Nov 19, 2009, 8:06:37 PM11/19/09
to beautifulsoup
Hi,

I'm just blundering into BeautifulSoup -- and Python in general -- to
run Tom Dyson's MySpace parser, http://www.throwingbeans.org/MySpace.py.txt,
so please forgive my ignorance.

When MySpace.py imports BeautifulSoup.py 3.1.0.1, Python 3.1.1 is
reporting SyntaxErrors.

First I got:

File "C:\Python31\lib\site-packages\BeautifulSoup.py", line 427
raise AttributeError, "'%s' object has no attribute '%s'" %
(self.__class__.__name__, attr)
[pointing at the comma after AttributeError]
SyntaxError: invalid syntax

Putting that string expression inside parens rather than after a comma
seems to make Python happy.

Now I get to:

File "C:\Python31\lib\site-packages\BeautifulSoup.py", line 438
return u'<![CDATA[' + self + u']]>'
[pointing at the single quote after "CDATA[" ]
SyntaxError: invalid syntax

I'm way out of my depth on this one, and don't understand how that's
all supposed to parse out, but Python doesn't like it. Any suggestions?

Aaron DeVore

unread,
Nov 23, 2009, 2:50:31 AM11/23/09
to beauti...@googlegroups.com
Drew,
You're using Python 3.1. Python 3.0 and up introduce some
incompatibilities in the language that break most programs written for
Python 2. That's why you're running into weird syntax errors.
Beautiful Soup can work on Python 3.1, but it requires some special
processing that works best on Unix/Linux. I recommend that you instead
use the latest version in the Python 2 series. As of today, that's
2.6.4.

Cheers!
Aaron DeVore
> --
>
> You received this message because you are subscribed to the Google Groups "beautifulsoup" group.
> To post to this group, send email to beauti...@googlegroups.com.
> To unsubscribe from this group, send email to beautifulsou...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/beautifulsoup?hl=.
>
>
>
Reply all
Reply to author
Forward
0 new messages