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 589671 - Fix pygtk on windows
Fix pygtk on windows
Status: RESOLVED FIXED
Product: pygtk
Classification: Bindings
Component: general
Git Master
Other Windows
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on: 562790
Blocks: 584679
 
 
Reported: 2009-07-25 03:55 UTC by John Stowers
Modified: 2010-04-16 10:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot of the PyGTK Installer throwing an exception (28.47 KB, image/jpeg)
2010-01-20 22:00 UTC, Manuel Cerón
  Details
pygobject changes (15.87 KB, patch)
2010-01-20 23:15 UTC, John Stowers
none Details | Review
pygtk changes (11.80 KB, patch)
2010-01-20 23:17 UTC, John Stowers
none Details | Review

Description John Stowers 2009-07-25 03:55:52 UTC
I have fixed pygtk and pygobject so they build on windows again. 

See the master-windows branch of

http://github.com/nzjrs/pygtk/tree/

I will give this a few more days of testing, and perhaps clean up setup.py a bit. 

Build instructions:

* Install gtk+ bundle from gtk.org
* Install Python2.6
* Install MinGW-5.14.exe and MSYS-1.0.11-rc-1.exe
* Add C:\GTK\bin to path (from windows)
* Add the following to your msys environment variables (open and append to C:\msys\1.0\etc\profile)

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/c/devel/lib/pkgconfig:/c/Python26/Lib/pkgconfig
export PATH=$PATH:/c/Python26:/c/Python26/bin
export CPPFLAGS="-I/c/Python26/include"
export LDFLAGS="-L/c/Python26/lib"

* In msys you can build with

python setup.py build --compiler=mingw32 --enable-threading --yes-i-know-its-
not-supported bdist_wininst
Comment 1 Ignacio Casal Quinteiro (nacho) 2009-08-11 14:29:41 UTC
Hi I tried to build the installer using your branch but I get the errors bellow, any clue how to solve it?

gtk/gdk.c: In function `_wrap_gdk_event_send_client_message':
gtk/gdk.c:349: warning: passing arg 2 of `gdk_event_send_client_message' makes p                                                                                                 ointer from integer without a cast
gdkevent.override: In function `_wrap_gdk_event_tp_getattr':
gdkevent.override:701: warning: passing arg 1 of `PyInt_FromLong' makes integer                                                                                                  from pointer without a cast
gdkevent.override:816: warning: passing arg 1 of `PyInt_FromLong' makes integer                                                                                                  from pointer without a cast
gdkevent.override: In function `_wrap_gdk_event_tp_setattr':
gdkevent.override:304: warning: assignment makes pointer from integer without a                                                                                                  cast
gdkevent.override:435: warning: assignment makes pointer from integer without a                                                                                                  cast
gdkcairo.override: In function `_wrap_gdk_cairo_create':
gdkcairo.override:251: warning: implicit declaration of function `PycairoContext                                                                                                 _FromContext'
gdkcairo.override:251: error: `PyGdkCairoContext_Type' undeclared (first use in                                                                                                  this function)
gdkcairo.override:251: error: (Each undeclared identifier is reported only once
gdkcairo.override:251: error: for each function it appears in.)
gdkcairo.override:251: warning: return makes pointer from integer without a cast
gtk/gdk.override: In function `_wrap_gdk_screen_set_font_options':
gtk/gdk.override:1553: error: `PycairoFontOptions_Type' undeclared (first use in                                                                                                  this function)
gtk/gdk.override:1554: error: `PycairoFontOptions' undeclared (first use in this                                                                                                  function)
gtk/gdk.override:1554: error: syntax error before ')' token
gtk/gdk.override: In function `_wrap_gdk_screen_get_font_options':
gtk/gdk.override:1535: warning: implicit declaration of function `PycairoFontOpt                                                                                                 ions_FromFontOptions'
gtk/gdk.override:1535: warning: return makes pointer from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_pixmap_foreign_new_for_screen':
gtk/gdk.c:16054: warning: passing arg 2 of `gdk_pixmap_foreign_new_for_screen' m                                                                                                 akes pointer from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_event_send_client_message_for_display':
gtk/gdk.c:16466: warning: passing arg 3 of `gdk_event_send_client_message_for_display' makes pointer from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_pixmap_foreign_new':
gtk/gdk.c:17619: warning: passing arg 1 of `gdk_pixmap_foreign_new' makes pointe                                                                                                 r from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_pixmap_lookup':
gtk/gdk.c:17637: warning: passing arg 1 of `gdk_pixmap_lookup' makes pointer fro                                                                                                 m integer without a cast
gtk/gdk.c: In function `_wrap_gdk_pixmap_foreign_new_for_display':
gtk/gdk.c:17655: warning: passing arg 2 of `gdk_pixmap_foreign_new_for_display'                                                                                                  makes pointer from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_pixmap_lookup_for_display':
gtk/gdk.c:17674: warning: passing arg 2 of `gdk_pixmap_lookup_for_display' makes                                                                                                  pointer from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_selection_send_notify':
gtk/gdk.c:18076: warning: passing arg 1 of `gdk_selection_send_notify' makes poi                                                                                                 nter from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_selection_send_notify_for_display':
gtk/gdk.c:18103: warning: passing arg 2 of `gdk_selection_send_notify_for_displa    
y' makes pointer from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_window_foreign_new':
gtk/gdk.c:18288: warning: passing arg 1 of `gdk_window_foreign_new' makes pointe                                                                                                 r from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_window_lookup':
gtk/gdk.c:18306: warning: passing arg 1 of `gdk_window_lookup' makes pointer fro                                                                                                 m integer without a cast
gtk/gdk.c: In function `_wrap_gdk_window_foreign_new_for_display':
gtk/gdk.c:18324: warning: passing arg 2 of `gdk_window_foreign_new_for_display'                                                                                                  makes pointer from integer without a cast
gtk/gdk.c: In function `_wrap_gdk_window_lookup_for_display':
gtk/gdk.c:18343: warning: passing arg 2 of `gdk_window_lookup_for_display' makes                                                                                                  pointer from integer without a cast
yGTK_2fWhatsNew28#update-constructors
Warning: Constructor for GdkPixbuf needs to be updated to new API
         See http://live.gnome.org/PyGTK_2fWhatsNew28#update-constructors
Warning: Constructor for GdkPixbufAnimation needs to be updated to new API
         See http://live.gnome.org/PyGTK_2fWhatsNew28#update-constructors
Warning: Constructor for GdkPixbufLoader needs to be updated to new API
         See http://live.gnome.org/PyGTK_2fWhatsNew28#update-constructors
Warning: Constructor for GdkPixbufSimpleAnim needs to be updated to new API
         See http://live.gnome.org/PyGTK_2fWhatsNew28#update-constructors
Warning: Constructor for GdkScreen needs to be updated to new API
         See http://live.gnome.org/PyGTK_2fWhatsNew28#update-constructors
Warning: Constructor for GdkVisual needs to be updated to new API
         See http://live.gnome.org/PyGTK_2fWhatsNew28#update-constructors
error: command 'gcc' failed with exit status 1
                                                                                             
Comment 2 John Stowers 2009-08-11 21:22:35 UTC
(In reply to comment #1)
> Hi I tried to build the installer using your branch but I get the errors
> bellow, any clue how to solve it?

I need more info. How closely did you follow my instructions. What were the versions of everything?
Comment 3 Ignacio Casal Quinteiro (nacho) 2009-08-12 11:22:03 UTC
I made what you did in your intructions. BTW I was able to build pygobject without problems, just some warnings at the end of the build but the installer was created perfectly.
About the versions:
python 2.6.2
pygobject from your branch
gtk+ 2.16.0 (the bundle one from the page of gtk+)

do you need something else?
Comment 4 Ignacio Casal Quinteiro (nacho) 2009-08-26 08:56:46 UTC
any news on this? Maybe you could provide me the installer so I can make a release with python support?
Comment 5 John Stowers 2009-08-26 09:07:09 UTC
I was not able to recreate your build failure.
Comment 6 Ignacio Casal Quinteiro (nacho) 2009-11-18 19:14:10 UTC
I think my problem was not having pycairo installed. Although I installed it and now it still crashes but this time complaining about that it doesn't find Pycairo_CAPI, I've installed the pycairo from the ftp (version 1.4) which one do you have installed?
Comment 7 John Stowers 2009-12-23 20:41:06 UTC
Sorry, I no longer have a windows install...
Comment 8 John Stowers 2010-01-20 14:22:36 UTC
(In reply to comment #0)
> I have fixed pygtk and pygobject so they build on windows again. 
> 
> See the master-windows branch of
> 
> http://github.com/nzjrs/pygtk/tree/
> 
> I will give this a few more days of testing, and perhaps clean up setup.py a
> bit. 
> 
> Build instructions:
> 
> * Install gtk+ bundle from gtk.org
> * Install Python2.6
> * Install MinGW-5.14.exe and MSYS-1.0.11-rc-1.exe
> * Add C:\GTK\bin to path (from windows)
> * Add the following to your msys environment variables (open and append to
> C:\msys\1.0\etc\profile)
> 
> export
> PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/c/devel/lib/pkgconfig:/c/Python26/Lib/pkgconfig
> export PATH=$PATH:/c/Python26:/c/Python26/bin
> export CPPFLAGS="-I/c/Python26/include"
> export LDFLAGS="-L/c/Python26/lib"
> 
> * In msys you can build with
> 
> python setup.py build --compiler=mingw32 --enable-threading --yes-i-know-its-
> not-supported bdist_wininst

I just went through and tested this again from start to finish. Works fine. Notes:

* using the Gtk-2.16 bundle
* pycairo is required
* MinGW-5.16.exe and MSYS-1.0.11.exe work great

If the build fails it is because pycairo has installed an incorrect pkgconfig file. Update its prefix line from this

prefix=c:\Python26

to this

prefix=C:/Python26
Comment 9 Ignacio Casal Quinteiro (nacho) 2010-01-20 14:46:46 UTC
Thanks a lot for the update, but just to be totally which version of pycairo have you installed?
Comment 10 John Stowers 2010-01-20 16:37:02 UTC
(In reply to comment #9)
> Thanks a lot for the update, but just to be totally which version of pycairo
> have you installed?

The most recent version available for windows - pycairo-1.4.12-2.win32-py2.6.exe

I also put windows installers here:
http://www.johnstowers.co.nz/files/win32/pygobject-2.19.0.win32-py2.6.exe
http://www.johnstowers.co.nz/files/win32/pygtk-2.16.0.win32-py2.6.exe

Good luck.
Comment 11 John Stowers 2010-01-20 16:38:46 UTC
Note: they are build without Glade support
Comment 12 John Stowers 2010-01-20 16:48:58 UTC
Version with glade support (not tested)

http://www.johnstowers.co.nz/files/win32/pygtk-2.16.0+glade.win32-py2.6.exe

The other versions, those without glade *have* been tested
Comment 13 Ignacio Casal Quinteiro (nacho) 2010-01-20 16:51:15 UTC
Thanks a lot for the info and the installers.
Comment 14 Rafael Villar Burke 2010-01-20 18:02:10 UTC
Works perfectly fine here, tested with a couple of not very complex 
applications.

There's only a minor problem, when installing pygtk (I've tested the one 
with glade):

Traceback (most recent call last):
  • File "<string>", line 101 in <module>
  • File "<string>", line 49 in html_fixxref
AttributeError: 'module' object has no attribute 'DOCDIR'

Thanks a lot for doing this work. I hope we can have soon again an up to 
date pygtk and pygobject intaller on ftp.gnome.org.
Comment 15 John Stowers 2010-01-20 18:10:55 UTC
(In reply to comment #14)
> Works perfectly fine here, tested with a couple of not very complex 
> applications.
> 
> There's only a minor problem, when installing pygtk (I've tested the one 
> with glade):

Thanks.

>
> Traceback (most recent call last):
> 

Yeah, the post install script could do with a rewrite. I might just remove it (it's only real use was installing the docs, and they are on library.gnome.org now)
Comment 16 John Stowers 2010-01-20 21:45:28 UTC
OK, I have updated the git repository.

If you want to build

PyGtk-2.16 --> check out the PYGTK_2_16_0_WINDOWS tag
PyGObject-2.19 --> check out the PYGOBJECT_2_19_0_WINDOWS tag
+ you will need to install
 - the Gtk+-2.16 bundle
 - Pycairo 1.4.12 (and you need to edit the pycairo.pc file to fix the prefix)

If you want to build
PyGtk-2.17 (development) --> check out HEAD
PyGObject-2.21 (development) --> check out HEAD
+ you will need to install
 - the Gtk+-2.18 bundle
 - Pycairo as above

If you need to build the glade bindings then you also need to
1) Install libxml-2.7.6 from http://xmlsoft.org/sources/win32/
2) Create libxml-2.0.pc in GTK/lib/pkg-config

prefix=/devel/target/f395ca5ef06001c341567c2c0043b7d3
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libxml-2.0
Description: Libxml
Version: 2.7.6
Libs: -L${libdir} -llibxml2
Libs.private: -L/opt/misc/lib -lexpat
Cflags: -I${includedir}

I DO NOT RECOMMEND BUILDING PYGTK-2.17. IT USES GTK+-2.18 WHICH IS BROKEN ON WINDOWS. PLEASE DOWNLOAD THE INSTALLERS in #c10 and #c12 INSTEAD
Comment 17 Manuel Cerón 2010-01-20 22:00:47 UTC
Created attachment 151875 [details]
Screenshot of the PyGTK Installer throwing an exception
Comment 18 Manuel Cerón 2010-01-20 22:04:37 UTC
(In reply to comment #12)
> Version with glade support (not tested)
> 
> http://www.johnstowers.co.nz/files/win32/pygtk-2.16.0+glade.win32-py2.6.exe
> 
> The other versions, those without glade *have* been tested

Thank you very much. This was really needed. I tested it with a fairly complex
application. It uses GtkBuilder, Actions and Glade 3. Everything was good.

There was only one minor problem. The installer throw me this exception:

Traceback (most recent call last):
  • File "<string>", line 98 in <module>
IOError: [Errno 2] No such file or directory:
'C:\\Python26\\bin\\pygtk-codegen-2.0'

I'm attaching an screenshot of the installer when threw the exception.

Thanks again.
Comment 19 John Stowers 2010-01-20 22:06:09 UTC
(In reply to comment #18)
> (In reply to comment #12)
> > Version with glade support (not tested)
> > 
> > http://www.johnstowers.co.nz/files/win32/pygtk-2.16.0+glade.win32-py2.6.exe
> > 
> > The other versions, those without glade *have* been tested
> 
> Thank you very much. This was really needed. I tested it with a fairly complex
> application. It uses GtkBuilder, Actions and Glade 3. Everything was good.
> 
> There was only one minor problem. The installer throw me this exception:

Thanks. The error is non fatal. I will make a new installer sometime, and upload it to the GNOME FTP servers.
Comment 20 Gian Mario Tagliaretti 2010-01-20 23:02:00 UTC
John as usual you have done a wonderful job, thanks a lot for building on windows.

If the changes required in master are not too much invasive (e.g. risk to break existing stuff) I will be happy if you could merge upstream, what do you think?
Comment 21 John Stowers 2010-01-20 23:14:11 UTC
(In reply to comment #20)
> John as usual you have done a wonderful job, thanks a lot for building on
> windows.
> 
> If the changes required in master are not too much invasive (e.g. risk to break
> existing stuff) I will be happy if you could merge upstream, what do you think?

Sounds great. 

I have attached the two patches for pygobject and pygtk. Some comments
 * There always seem to be a few globs of the def file that break the build on windows (perhaps because the underlying library has not exported the symbol properly, the cause is not always the same). For this reason I am tempted to keep a seperate windows branch with *only* these differences to master
 * The bulk of the changes are in PyGObject. Half of these are setup.py changes, massaging libtool to build pyglib as a static library.
 * The other part of the PyGObject changes are fallout from this. generate-constants.c had to be removed because It is not possible to run such a tool from distutils. I made a python equivalent and did an API dance to maintain compatibility.
 * I also needed to initialize glib from gio to stop a crash (for the case where gio is imported before gobject). Not sure why this crash does not appear on windows

Anyway, I appreciate your comments. If you like I can clean up these into a clean patch series, push it to a windows branch (in pygtk and pygobject) and then cherrypick all changes except the defs commenting out to master

Thoughts?
Comment 22 John Stowers 2010-01-20 23:15:47 UTC
Created attachment 151891 [details] [review]
pygobject changes
Comment 23 John Stowers 2010-01-20 23:17:08 UTC
Created attachment 151892 [details] [review]
pygtk changes
Comment 24 John Stowers 2010-01-20 23:18:45 UTC
> changes, massaging libtool to build pyglib as a static library.
                     ^^^^^^^
Argh. I mean massaging distutils.
Comment 25 John Stowers 2010-01-21 22:02:20 UTC
I uploaded new installers with the fixes people have reported. I expect these installers to be the 'final' blessed installers at some point. Feedback welcome.

Stable (requires the Gtk+-2.16 bundle)
http://www.johnstowers.co.nz/files/win32/pygobject-2.20.0.win32-py2.6.exe
http://www.johnstowers.co.nz/files/win32/pygtk-2.16.0.win32-py2.6.exe
http://www.johnstowers.co.nz/files/win32/pygtk-2.16.0+glade.win32-py2.6.exe
Comment 26 Ignacio Casal Quinteiro (nacho) 2010-01-21 22:07:37 UTC
Just say that I was also able to make the installers with your branch and instructions, thanks a lot for the great work.
Comment 27 Rafael Villar Burke 2010-01-22 08:57:26 UTC
The installation of pygobject and pygtk+glade end with this message:

"close failed in file object destructor:
Error in sys.excepthook:

Original exception was:"

Other than that, they work fine using a couple of apps as test.

Great work, John!
Comment 28 John Stowers 2010-01-22 10:58:04 UTC
(In reply to comment #27)
> The installation of pygobject and pygtk+glade end with this message:
> 
> "close failed in file object destructor:
> Error in sys.excepthook:
> 
> Original exception was:"

Hmm, interesting. Does this occur in the postinstall script? I have not seen this before. Can you please check if there is anything interesting written in 

C:/documents and settings/your name/local ??/temp/pygobject_postinstall.log?

John
Comment 29 Rafael Villar Burke 2010-01-22 11:16:39 UTC
C:\Users\pachi\AppData\Local\Temp\pygobject_postinstall.log contents:

--
pygobject is now installed on your machine.

Local configuration files were successfully updated.
--

Same with the pygtk log.
Comment 30 John Stowers 2010-01-22 11:18:49 UTC
(In reply to comment #29)
> C:\Users\pachi\AppData\Local\Temp\pygobject_postinstall.log contents:
> 
> --
> pygobject is now installed on your machine.
> 
> Local configuration files were successfully updated.
> --
> 
> Same with the pygtk log.

So it looks like the the error is coming from the installer executable, and not the postinstall script (which is where the previous errors came from)

Very weird and I don't know how to debug nor fix this one...
Comment 31 Rafael Villar Burke 2010-01-22 11:26:54 UTC
It looks harmless, only a bit ugly.
Anyhow, really good work. Big thanks again.

And, abusing your knowledge about building the pygtk+ stack on win32, do you know why there's no updated cairo bindings yet?. Cairo is going to release 1.10 and we still live with a 1.4.x version and, AFAICT, there has been a great deal of performance improvements in all this time.
Comment 32 Ignacio Casal Quinteiro (nacho) 2010-01-22 11:44:37 UTC
One of the reasons for not having an updated pycairo is this:
http://bugs.freedesktop.org/show_bug.cgi?id=22940
Comment 33 Rafael Villar Burke 2010-01-22 11:55:59 UTC
Wouldn't it be good to have a mingw compiled pycairo installer meanwhile? I can understand that aiming at VS compiled installers can be a good idea, and working to have patches for it, but it's orthogonal to having more current versions.

AFAICT, there has never been VS compiled installers on ftp.gnome.org and even if it would allow better msi installers, should we be blocking on this and make the pygtk stack obsolete on win32?
Comment 34 John Stowers 2010-01-22 12:44:11 UTC
I just built a working pycairo installer for pycairo-1.8.6. I also fixed the pkg-config file so the hack mentioned earlier re: adjusting the prefix is no longer needed.

http://www.johnstowers.co.nz/files/win32/pycairo-1.8.6.win32-py2.6.exe

I also built 1.8.8 with some hacking of tp_base I am not sure about. The reasons for this hacking is some bug-ish thing in GCC-3.4.5 on cygwin/mingw. This bug is kind of described here

http://www.mail-archive.com/patches@python.org/msg02861.html

and appears in pycairo here

https://bugs.freedesktop.org/show_bug.cgi?id=25203

Both 1.8.6 and 1.8.8 pass all the tests and display the examples correctly, however I am only releasing 1.8.6 at this time. I will add a comment on the upstream pycairo bug.
Comment 35 Rafael Villar Burke 2010-01-22 12:47:55 UTC
Wow! That was quick!
Thanks again for your work, John.

Soon we'll have again an up-to-date set of PyGTK installers on ftp.gnome.org. Yay! :D.
Comment 36 John Stowers 2010-01-22 12:55:45 UTC
> Soon we'll have again an up-to-date set of PyGTK installers on ftp.gnome.org.
> Yay! :D.

I hope so. I don't have a GPG key to sign the installers with, nor do I have any idea how to get these installers on ftp.gnome.org.

Help appreciated with both those steps.

John
Comment 37 Ignacio Casal Quinteiro (nacho) 2010-01-22 16:57:45 UTC
I uploaded the files to ftp.gnome.org.
Comment 38 Rafael Villar Burke 2010-01-22 17:53:11 UTC
They are now announced in the www.pygtk.org website.
Thanks folks for your great work.
Comment 39 Ignacio Casal Quinteiro (nacho) 2010-01-22 21:04:48 UTC
There is still a bug: if you go to: C:\Python26\share\pygtk\2.0\defs

in the next files "gtk/" should be removed:
gdk-types.defs:
(include "gtk/gdk-base-types.defs")

gtk-types.defs:
(include "gtk/gtk-2.16-types.defs")
(include "gtk/gtk-2.14-types.defs")
(include "gtk/gtk-2.12-types.defs")
(include "gtk/gtk-2.10-types.defs")
(include "gtk/gtk-base-types.defs")
Comment 40 John Stowers 2010-01-25 19:46:34 UTC
(In reply to comment #39)
> There is still a bug: if you go to: C:\Python26\share\pygtk\2.0\defs
> 
> in the next files "gtk/" should be removed:
> gdk-types.defs:
> (include "gtk/gdk-base-types.defs")
> 
> gtk-types.defs:
> (include "gtk/gtk-2.16-types.defs")
> (include "gtk/gtk-2.14-types.defs")
> (include "gtk/gtk-2.12-types.defs")
> (include "gtk/gtk-2.10-types.defs")
> (include "gtk/gtk-base-types.defs")

OK, I think I have fixed this. I will check I have not broken codegen for other users
Comment 41 Rafael Villar Burke 2010-04-04 22:26:23 UTC
The released packages fail now with Python 2.6.5 and I suspect it's related to a patch included in that micro version to avoid problems with manifests and VC2008 redistributable issues for bdist_wininst generated extensions.

The following is what I could investigate...

On 03/04/2010 12:06, Mark Schafer wrote:
>> I have installed and have working python 2.6.5
>> I have installed GTK+Runtime installer from here: http://gtk-win.sourceforge.net/home/index.php/en/Home
>> I have installed pygtk-2.16.0+glade.win32-py2.6.exe
>>
>> and I have the same error as Mosh:
>> >>> import gtk
>> Traceback (most recent call last):
>>   File "<pyshell#0>", line 1, in <module>
>>     import gtk
>>   File "C:\Python26\lib\site-packages\gtk-2.0\gtk\__init__.py", line 40, in <module>
>>     from gtk import _gtk
>> ImportError: DLL load failed: The specified procedure could not be found.

On 04/04/2010 21:58, Rafael Villar Burke (Pachi) wrote:
> Hi Mark, I'm having a similar problem but only for frozen applications (py2exe) when run on other machines (on mine they work fine).
This is exactly what other users trying my pygtk application report:

Traceback (most recent call last):
  • File "condensa", line 35 in <module>
  • File "condensaciones\gtkui.pyo", line 25 in <module>
  • File "gtk\__init__.pyo", line 40 in <module>
  • File "gtk\_gtk.pyo", line 12 in <module>
  • File "gtk\_gtk.pyo", line 10 in __load
ImportError: DLL load failed: No se encontró el proceso especificado.

>
> I've recently upgraded to python 2.6.5 and I didn't have the problem till then, so maybe it's related.
>
> Can you check if using a different version of python (not 2.6.5), like 2.6.4 works for you?
>
> Please, tell us if  you find anything new, and I'm also clueless about what could be the problem here.
The issue looks like what's described in a comp.lang.python thread here [1]
If you can check that installing the VC2008 redistributable [2] solves the problem for you then we may have further evidence.

AFAICT, the problem in your case is that you are missing the VC2008 redistributable package on your system, but the pygtk installer was built using python 2.6.4, which requires it (so it should also work with Python 2.6.4 on the system).  In my case, everything works fine locally, because I have the VC2008 redist installed system-wide but, when distributing the frozen app, the embeded python dll requires it to load _gtk.pyd (a DLL) and fails in systems without the VC2008 redistributable package installed.

The following Python issues are related to the problem [3][4]

The patch to issue 4120 [4] was merged into the new Python 2.6.5 release [5] to avoid the dependence of wininst_bdist extensions on the VC2008 redistributable.

If this is the problem that's happening, then building the PyGTK, PyGObject and PyCairo installers using a newer Python 2.6.5 could fix the problem.

[1] http://groups.google.com/group/comp.lang.python/browse_thread/thread/3ec6af1279a162ca#
[2] http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en
[3] http://bugs.python.org/issue7833
[4] http://bugs.python.org/issue4120
[5] http://www.python.org/download/releases/2.6.5/NEWS.txt


So, could new installers be generated using the new Python 2.6.5 release to see if this fixes these problems?
Comment 42 John Stowers 2010-04-05 00:01:46 UTC
I am in transit at the moment, but will do this when I get back to NZ.

It would be good if there was a stable PyGtk (2.18) and PyGObject (2.22) release I could use as the base...
Comment 43 Gian Mario Tagliaretti 2010-04-05 09:58:45 UTC
Review of attachment 151892 [details] [review]:

John you removed a couple of objects and methods, like MountOperation and AppLaunchContext and some in Atk, what are we going to do with these?
Comment 44 Gian Mario Tagliaretti 2010-04-05 10:01:08 UTC
Review of attachment 151891 [details] [review]:

Same here with some flags and enums, I'm most likely missing something.
Comment 45 John Stowers 2010-04-06 00:26:34 UTC
(In reply to comment #43)
> Review of attachment 151892 [details] [review]:
> 
> John you removed a couple of objects and methods, like MountOperation and
> AppLaunchContext and some in Atk, what are we going to do with these?

Yeah, thanks for the review. As I mentioned in c21 these sorts of hacks seem to be transient, I re-check them with each new release. I suppose the root cause of them causing the build to fail is somewhere else in glib. Regarding ATK, Alberto tells me it doesnt work on windows anyway.

Basically what would be ideal is if all the patch was merged *except* the parts where I removed objects and methods, they would live in a windows branch in git instead.

Thoughts?
Comment 46 Gian Mario Tagliaretti 2010-04-06 05:25:09 UTC
(In reply to comment #45)

> Basically what would be ideal is if all the patch was merged *except* the parts
> where I removed objects and methods, they would live in a windows branch in git
> instead.
> 
> Thoughts?

I agree John, please commit.
Comment 47 John Ehresman 2010-04-13 18:20:29 UTC
Any chance of committing soon?  I'm interested in the working setup.py build scripts
Comment 48 John Ehresman 2010-04-13 20:22:14 UTC
Small bug: in gobjectmodule.c, G_MAXULONG needs to be set via

    PyModule_AddObject(m, "G_MAXULONG", PyLong_FromUnsignedLong(G_MAXULONG));
Comment 49 John Stowers 2010-04-13 23:01:25 UTC
(In reply to comment #47)
> Any chance of committing soon?  I'm interested in the working setup.py build
> scripts

I get back from holiday tomorrow - promise it will be committed within the next 3 days!
Comment 50 John Stowers 2010-04-13 23:02:00 UTC
(In reply to comment #48)
> Small bug: in gobjectmodule.c, G_MAXULONG needs to be set via
> 
>     PyModule_AddObject(m, "G_MAXULONG", PyLong_FromUnsignedLong(G_MAXULONG));

Thanks for the review.
Comment 51 John Stowers 2010-04-16 10:40:33 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.