ImportError: No module named glib

Discussion in 'Python' started by Michael Joachimiak, Mar 5, 2010.

  1. I am too new to python.
    If anybody has an idea what to do please help.
    when I use

    import glib

    in my code I get this:

    >>> import glib

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: No module named glib

    :~$ python -V
    Python 2.6.4

    /usr/lib/libpyglib-2.0-python2.6.so.0.0.0 exists in version 2.18.0-0ubuntu2

    :~$ pkg-config glib-2.0 --cflags --libs
    -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0
     
    Michael Joachimiak, Mar 5, 2010
    #1
    1. Advertising

  2. Michael Joachimiak

    Peter Otten Guest

    Michael Joachimiak wrote:

    > I am too new to python.
    > If anybody has an idea what to do please help.
    > when I use
    >
    > import glib
    >
    > in my code I get this:
    >
    >>>> import glib

    > Traceback (most recent call last):
    > File "<stdin>", line 1, in <module>
    > ImportError: No module named glib
    >
    > :~$ python -V
    > Python 2.6.4
    >
    > /usr/lib/libpyglib-2.0-python2.6.so.0.0.0 exists in version
    > 2.18.0-0ubuntu2
    >
    > :~$ pkg-config glib-2.0 --cflags --libs
    > -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0


    After the following random walk through my system

    $ python
    Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55)
    [GCC 4.4.1] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import glib
    >>> glib.__file__

    '/usr/lib/pymodules/python2.6/gtk-2.0/glib/__init__.pyc'

    In the above __init__.py:
    ....
    from glib._glib import *
    _PyGLib_API = _glib._PyGLib_API

    del _glib
    ....

    >>> import sys
    >>> sys.modules["glib._glib"]

    <module 'glib._glib' from
    '/usr/lib/pymodules/python2.6/gtk-2.0/glib/_glib.so'>
    >>>

    $ dpkg -S _glib.so
    python-gobject: /usr/lib/pyshared/python2.5/gtk-2.0/glib/_glib.so
    python-gobject: /usr/lib/pyshared/python2.6/gtk-2.0/glib/_glib.so
    $

    .... I believe that you have to install the python-gobject package.

    Peter
     
    Peter Otten, Mar 5, 2010
    #2
    1. Advertising

  3. Michael Joachimiak

    hanu

    Joined:
    Jun 20, 2013
    Messages:
    1
    hi guys ... i am facing the same problem .. plz help
     
    hanu, Jun 20, 2013
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Harry George
    Replies:
    0
    Views:
    5,725
    Harry George
    Jul 15, 2003
  2. Mikael Olofsson
    Replies:
    0
    Views:
    451
    Mikael Olofsson
    Jul 16, 2003
  3. Carsten Gehling

    pso - ImportError: No module named url

    Carsten Gehling, Jul 16, 2003, in forum: Python
    Replies:
    0
    Views:
    395
    Carsten Gehling
    Jul 16, 2003
  4. eric_bellard
    Replies:
    1
    Views:
    5,141
    CarlosRivera
    Oct 7, 2004
  5. Terry Reedy

    Re: ImportError: No module named glib

    Terry Reedy, Mar 5, 2010, in forum: Python
    Replies:
    0
    Views:
    708
    Terry Reedy
    Mar 5, 2010
Loading...

Share This Page