freeze.py builds, but binary doesn't even run locally (shared GTK problem?)

freeze.py builds, but binary doesn't even run locally (shared GTK problem?)

Post by kristian.h » Sun, 09 Apr 2006 13:42:06


eherman@ibmlnx20:/tmp$ cat helloworld.py

#!/usr/bin/env python



import pygtk

pygtk.require('2.0')

import gtk



class HelloWorld:



def __init__(self):

self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

self.window.show()



def main(self):

gtk.main()



if __name__ == "__main__":

hello = HelloWorld()

hello.main()

keherman@ibmlnx20:/tmp$
/usr/share/doc/python2.4/examples/Tools/freeze/freeze.py
helloworld.py



Name File

---- ----

m BaseHTTPServer /usr/lib/python2.4/BaseHTTPServer.py

m FixTk /usr/lib/python2.4/lib-tk/FixTk.py

m SocketServer /usr/lib/python2.4/SocketServer.py

m StringIO /usr/lib/python2.4/StringIO.py

m Tkconstants /usr/lib/python2.4/lib-tk/Tkconstants.py

m Tkinter /usr/lib/python2.4/lib-tk/Tkinter.py

m UserDict /usr/lib/python2.4/UserDict.py

m __builtin__

m __main__ helloworld.py

m _codecs

m _locale /usr/lib/python2.4/lib-dynload/_locale.so

m _random /usr/lib/python2.4/lib-dynload/_random.so

m _socket /usr/lib/python2.4/lib-dynload/_socket.so

m _sre

m _ssl /usr/lib/python2.4/lib-dynload/_ssl.so

m _threading_local /usr/lib/python2.4/_threading_local.py

m _tkinter /usr/lib/python2.4/lib-dynload/_tkinter.so

m array /usr/lib/python2.4/lib-dynload/array.so

m atexit /usr/lib/python2.4/atexit.py

m base64 /usr/lib/python2.4/base64.py

m binascii /usr/lib/python2.4/lib-dynload/binascii.so

m cStringIO /usr/lib/python2.4/lib-dynload/cStringIO.so

m codecs /usr/lib/python2.4/codecs.py

m collections
/usr/lib/python2.4/lib-dynload/collections.so

m copy /usr/lib/python2.4/copy.py

m copy_reg /usr/lib/python2.4/copy_reg.py

m dis /usr/lib/python2.4/dis.py

P distutils /usr/lib/python2.4/distutils/__init__.py

m distutils.dep_util /usr/lib/python2.4/distutils/dep_util.py

m distutils.errors /usr/lib/python2.4/distutils/errors.py

m distutils.log /usr/lib/python2.4/distutils/log.py

m distutils.spawn /usr/lib/python2.4/distutils/spawn.py

m distutils.util /usr/lib/python2.4/distutils/util.py

m dummy_thread /usr/lib/python2.4/dummy_thread.py

P email /usr/lib/python2.4/email/__init__.py

m email.Charset /usr/lib/python2.4/email/Charset.py

m email.Encoders /usr/lib/python2.4/email/Encoders.py

m email.Errors /usr/lib/python2.4/email/Errors.py

m email.FeedParser /usr/lib/python2.4/email/FeedParser.py

m email.Generator /usr/lib/python2.4/email/Generator.py

m email.Header /usr/lib/python2.4/email/Header.py

m email.Iterators /usr/lib/python2.4/email/Iterators.py

m email.Message /usr/lib/python2.4/email/Message.py

m email.Parser /usr/lib/python2.4/email/Parser.py

m email.Utils /usr/lib/python2.4/email/Utils.py

m email._parseaddr /usr/lib/python2.4/email/_parseaddr.py

m em
 
 
 

freeze.py builds, but binary doesn't even run locally (shared GTK problem?)

Post by Martin v. » Sun, 09 Apr 2006 18:58:13


If you look at the freeze output, you'll notice that _gtk is
not linked into your application: It is a shared library (.so),
so it can't be frozen.

Instead, the resulting binary will look for _gtk.so on sys.path.
Try copying _gtk.so into the directory where the binary is,
or set PYTHONPATH before running the binary.

If you want to freeze _gtk into the application, you need it as
a static library.

Regards,
Martin