After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 643746 - Syntax error on gi/types.py with python 2.5.5
Syntax error on gi/types.py with python 2.5.5
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2011-03-03 03:27 UTC by Juan Pablo Ugarte
Modified: 2011-03-03 23:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Juan Pablo Ugarte 2011-03-03 03:27:53 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):
  • File "<stdin>", line 1 in <module>
  • File "/home/xjuan/checkout/prefix/lib64/python2.5/site-packages/gi/__init__.py", line 27 in <module>
    from gi.repository import GObject
  • File "/home/xjuan/checkout/prefix/lib64/python2.5/site-packages/gi/repository/__init__.py", line 25 in <module>
    from ..importer import DynamicImporter
  • File "/home/xjuan/checkout/prefix/lib64/python2.5/site-packages/gi/importer.py", line 30 in <module>
    from .module import DynamicModule, DynamicGObjectModule
  • File "/home/xjuan/checkout/prefix/lib64/python2.5/site-packages/gi/module.py", line 47 in <module>
    from .types import \
  • File "/home/xjuan/checkout/prefix/lib64/python2.5/site-packages/gi/types.py", line 55
    return info.invoke(*args, gtype=cls.__gtype__)
SyntaxError: invalid syntax
>>>
Comment 1 johnp 2011-03-03 18:48:58 UTC
>>> 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?
Comment 2 johnp 2011-03-03 20:16:17 UTC
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__))