GNOME Bugzilla – Bug 643746
Syntax error on gi/types.py with python 2.5.5
Last modified: 2011-03-03 23:48:27 UTC
xjuan@Xjuan:~/sources/glade$ python I get this weird syntax error when I try to import the gi module if I run pygobject with python 2.5, works well with 2.6.6 Python 2.5.5 (r255:77872, Feb 28 2011, 16:35:35) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pygtk >>> pygtk.require('2.0') >>> import gi Traceback (most recent call last):
+ Trace 226175
from gi.repository import GObject
from ..importer import DynamicImporter
from .module import DynamicModule, DynamicGObjectModule
from .types import \
return info.invoke(*args, gtype=cls.__gtype__)
>>>
>>> import pygtk >>> pygtk.require('2.0') Those aren't needed. I'm not sure what it means by invalid syntax. info.invoke(*args, gtype=cls.__gtype__) is clearly correct syntax unless 2.5 doesn't allow *args and then a explicit keyword. If you change that line to: kwds = {'gtype': cls.__gtype__} info.invoke(*args, **kwrds) does it work?
Yep, that's it. Just got our resident Python guru to compile 2.5 and test it. in python < 2.6 you can't place literal keywords after sending in a *arg. Fix is to do this: info.invoke(*args, **dict(gtype=cls.__gtype__))