[pygtk] cannot import glib in python shell

uticdmarceau2007 at yahoo.ca uticdmarceau2007 at yahoo.ca
Thu Dec 24 02:37:43 WST 2009


Hello everyone,

I'm trying to document a recipe to get the anomos python sources running
on winxp Pentium3 laptop.  I've installed the latest 2.6
python/mingw/msys/gtk and related binaries(glib, etc...)

This link has all the information about running anomos python sources on
a linux box:
http://anomos.info/trac/wiki/KnowledgeBase

-------------------------------
Here is my msys/home/user/.profile:
CC='/mingw/bin/gcc.exe '
CFLAGS='-march=pentium3 -mtune=i586 -mthreads -O2 -fomit-frame-pointer
-mms-bitfields -pipe '
CPPFLAGS='-I/mingw/include -DMINGW32 -D__MINGW32__ '
CXXFLAGS="${CFLAGS}"
LDFLAGS='-L/mingw/lib -Wl,--enable-auto-image-base
-Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc '
PKG_CONFIG_PATH="C:\MinGW\lib\pkgconfig"
export CC CFLAGS CPPFLAGS CXXFLAGS LDFLAGS PKG_CONFIG_PATH

export
PATH=.:/c/OpenSSL:/c/OpenSSL/bin:/c/OpenSSL/lib:/c/Venster/venster:/c/Venster:/c/gccxml:/c/Python26:/c/Python26/Lib/site-packages/M2Crypto:/c/Python26/DLLs:/c/Python26/tcl/dde1.3:/c/Python26/tcl/reg1.2:/c/Python26/tcl/tix8.4.3:/c/gtkwin/bin:c/gtkwin/lib:/c/gtkmm/bin:/c/gtkmm/lib:/c/gtkmm/redist:/mingw/bin:/bin:/usr/local/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:"/c/Program
Files/Common Files/Ahead/Lib"
export
PKG_CONFIG_PATH=/c/Python26/Lib/pkgconfig:/c/gtkmm/lib/pkgconfig:/c/gtkwin/lib/pkgconfig:/c/gtkwin/manifest:/c/mingw/lib/pkgconfig
export
LD_LIBRARY_PATH=/c/gtkmm/redist:/c/gtkmm/bin:/c/gtkwin/bin:/c/gtkwin/lib:/c/mingw/lib
-------------------------
The odd thing is that I can compile a c++ source file that needs glib
and it's running/linking, but the python doesn't find glib when I do
"import glib" from the python shell.
gcc -Wall -o anomos.exe pkg-config --cflags gtkmm-2.4 pangomm-1.4
anomos.cc pkg-config --libs gtkmm-2.4 pangomm-1.4 -lstdc++
glib is at least in two dirs:gtkwin/lib and mingw/lib because the
binaries are installed in gtkwin/lib and I compile glib with the latest
sources and installed/tested them from mingw/lib.
---------------------------------

I think ideally what I'm requesting is to have the mingw/python/gtk
environments to be harmonized.  I'm close.  I can do the following:
python
import sys
import gtk
blah = gtk.Window(0)
blah.show()
, but when I do
import glib
ERROR!!!
if I cd to a certain dir in glib sources, there were two .py files, but
I didn't know where to place them in the python26 dir.


More information about the pygtk mailing list