Re: Syntax error importing gi module



Try with python2.6. I believe that our minimum required version.

Also, you should not use pygtk and gi at the same time. Pygtk is for
the old static bindings and will not change the version of the module
from gi. Do this instead (if using the git version):

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

On Thu, Mar 3, 2011 at 12:28 AM, Juan Pablo Ugarte
<juanpablougarte gmail com> wrote:
> Hi guys, I just build pygobject using jhbuild following the instructions in
> http://live.gnome.org/PyGObject
> I build gtk+-3 instead and i get the following syntax error when trying to
> import gi.
>
> xjuan@Xjuan:~/sources/glade$ python
> 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
>>>>
>
> Is this a know issue?
>
> thanks
>
> Juan Pablo
> _______________________________________________
> python-hackers-list mailing list
> python-hackers-list gnome org
> http://mail.gnome.org/mailman/listinfo/python-hackers-list
>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]