Python 3 syntax error question

Peter Otten __peter__ at web.de
Sun Jun 26 10:59:58 EDT 2011


rzed wrote:

> I've tried to install PySVG in a Python 3 setting, and I get a few
> errors on the build. Most are easy to fix, but this one I can't
> explain or fix:
> 
> <error>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "builders.py", line 12, in <module>
>     from pysvg.shape import *
>   File "C:\Python32\lib\site-packages\pysvg\shape.py", line 91
>     def moveToPoint(self,(x,y)):
>                          ^
> SyntaxError: invalid syntax
> </error>
> 
> The moveToPoint method occurs three times in the file, with identical
> signatures. The other two are not showing up as errors, though since
> they occur later in the file, that may not be indicative.
> 
> I don't see anything erroneous in this line. The syntax error often
> comes from the previous line, but I've moved this method around and
> it has always failed on this line and no other, regardless of what
> went before.
> 
> I'm new to Py3, so maybe there's some obvious thing I'm not seeing
> here. Does anyone have any suggestions?
> 

Quoting

http://docs.python.org/dev/py3k/whatsnew/3.0.html#removed-syntax

"""
You can no longer write def foo(a, (b, c)): .... Use def foo(a, b_c): b, c = 
b_c instead.
"""

If there isn't a Python 3 version of PySVG you can try to run it through

http://docs.python.org/dev/py3k/library/2to3.html#to3-reference

to make the easy changes.




More information about the Python-list mailing list