freeze.py and GTK apps

K

kristian.hermansen

After freezing a PYGTK app, I am unable to run it. It this a common
problem, because I could not find any documentation on it at all.

I tried freezing this example, which gets by the make as well, but
running it results in a failure. This is on Ubuntu Linux:
http://www.moeraki.com/pygtktutorial/pygtk2tutorial/examples/helloworld.py

$ ./helloworld
Traceback (most recent call last):
File "helloworld.py", line 7, in ?
import gtk
File "/usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line
37, in ? from _gtk import *
ImportError: No module named _gtk

Any suggestions?
 
A

Adam DePrince

After freezing a PYGTK app, I am unable to run it. It this a common
problem, because I could not find any documentation on it at all.

I tried freezing this example, which gets by the make as well, but
running it results in a failure. This is on Ubuntu Linux:
http://www.moeraki.com/pygtktutorial/pygtk2tutorial/examples/helloworld.py

$ ./helloworld
Traceback (most recent call last):
File "helloworld.py", line 7, in ?
import gtk
File "/usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line
37, in ? from _gtk import *
ImportError: No module named _gtk

Any suggestions?
From the freeze README

A warning about shared library modules
--------------------------------------

When your Python installation uses shared library modules such as
_tkinter.pyd, these will not be incorporated in the frozen program.
Again, the frozen program will work when you test it, but it won't
work when you ship it to a site without a Python installation.

Freeze prints a warning when this is the case at the end of the
freezing process:

Warning: unknown modules remain: ...

When this occurs, the best thing to do is usually to rebuild Python
using static linking only. Or use the approach described in the previous
section to declare a library path using sys.path, and place the modules
such as _tkinter.pyd there.

Same applies here ...
 
K

Kristian Hermansen

When your Python installation uses shared library modules such as
_tkinter.pyd, these will not be incorporated in the frozen program.
Again, the frozen program will work when you test it, but it won't
work when you ship it to a site without a Python installation.

No, it didn't even run!!! So, it won't run frozen on ANY system. The
_gtk import choked the whole program and it died with exit status ==
1. So, even though I did have the GTK libraries locally, the program
exited improperly. The unfrozen script ran fine, so isn't this a
different problem entirely?
Freeze prints a warning when this is the case at the end of the
freezing process:

Warning: unknown modules remain: ...

When this occurs, the best thing to do is usually to rebuild Python
using static linking only. Or use the approach described in the previous
section to declare a library path using sys.path, and place the modules
such as _tkinter.pyd there.

Same applies here ...

Well, what we want is a totally static frozen build, but if not
possible (GTK is huge right?), GTK is assumed to be on the target
machine. However, the frozen binary still doesn't run properly. Any
suggestions? Try freezing the example code yourself and running it,
perhaps I am doing something amazingly wrong here...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,757
Messages
2,569,543
Members
45,026
Latest member
camilin05

Latest Threads

Top