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

  • Thread starter kristian.hermansen
  • Start date
K

kristian.hermansen

keherman@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 email.base64MIME /usr/lib/python2.4/email/base64MIME.py

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

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

m encodings.aliases /usr/lib/python2.4/encodings/aliases.py

m errno

m exceptions

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

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

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

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

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

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

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

m gobject
/usr/lib/python2.4/site-packages/gtk-2.0/gobject.so

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

P gtk
/usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py

m gtk._gtk
/usr/lib/python2.4/site-packages/gtk-2.0/gtk/_gtk.so

m gtk.keysyms
/usr/lib/python2.4/site-packages/gtk-2.0/gtk/keysyms.py

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

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

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

m imp

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

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

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

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

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

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

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

m marshal

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

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

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

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

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

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

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

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

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

m posix

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

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

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

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

m pygtk /usr/lib/python2.4/site-packages/pygtk.py

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

m sys

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

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

m thread

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

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

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

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

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

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

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

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

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

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

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

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



Missing modules:

? Carbon.File imported from macpath

? Carbon.Folder imported from tempfile

? Carbon.Folders imported from tempfile

? EasyDialogs imported from getpass

? MacOS imported from Tkinter, py_compile

? SOCKS imported from ftplib

? _emx_link imported from os

? _winreg imported from urllib

? ce imported from os

? gdk imported from gtk

? ic imported from pydoc, urllib, webbrowser

? ltihooks imported from gtk

? mac imported from os

? msvcrt imported from getpass

? nt imported from ntpath, os

? org.python.core imported from copy

? os.path imported from os

? os2 imported from os

? riscos imported from os

? riscosenviron imported from os

? riscospath imported from os

? rourl2path imported from urllib

? sitecustomize imported from site



freezing BaseHTTPServer ...

freezing FixTk ...

freezing SocketServer ...

freezing StringIO ...

freezing Tkconstants ...

freezing Tkinter ...

freezing UserDict ...

freezing __main__ ...

freezing _threading_local ...

freezing atexit ...

freezing base64 ...

freezing codecs ...

freezing copy ...

freezing copy_reg ...

freezing dis ...

freezing distutils ...

freezing distutils.dep_util ...

freezing distutils.errors ...

freezing distutils.log ...

freezing distutils.spawn ...

freezing distutils.util ...

freezing dummy_thread ...

freezing email ...

freezing email.Charset ...

freezing email.Encoders ...

freezing email.Errors ...

freezing email.FeedParser ...

freezing email.Generator ...

freezing email.Header ...

freezing email.Iterators ...

freezing email.Message ...

freezing email.Parser ...

freezing email.Utils ...

freezing email._parseaddr ...

freezing email.base64MIME ...

freezing email.quopriMIME ...

freezing encodings ...

freezing encodings.aliases ...

freezing fnmatch ...

freezing formatter ...

freezing ftplib ...

freezing getopt ...

freezing getpass ...

freezing glob ...

freezing gopherlib ...

freezing gtk ...

freezing gtk.keysyms ...

freezing htmlentitydefs ...

freezing htmllib ...

freezing httplib ...

freezing inspect ...

freezing linecache ...

freezing locale ...

freezing macpath ...

freezing macurl2path ...

freezing markupbase ...

freezing mimetools ...

freezing mimetypes ...

freezing ntpath ...

freezing nturl2path ...

freezing opcode ...

freezing os ...

freezing os2emxpath ...

freezing popen2 ...

freezing posixpath ...

freezing py_compile ...

freezing pydoc ...

freezing pygtk ...

freezing quopri ...

freezing random ...

freezing re ...

freezing repr ...

freezing rfc822 ...

freezing sgmllib ...

freezing site ...

freezing socket ...

freezing sre ...

freezing sre_compile ...

freezing sre_constants ...

freezing sre_parse ...

freezing stat ...

freezing string ...

freezing tempfile ...

freezing threading ...

freezing token ...

freezing tokenize ...

freezing traceback ...

freezing tty ...

freezing types ...

freezing urllib ...

freezing urlparse ...

freezing uu ...

freezing warnings ...

freezing webbrowser ...

generating table of frozen modules

Warning: unknown modules remain: _locale _random _socket _ssl _tkinter
array binascii cStringIO collections fcntl gobject gtk._gtk itertools
math pwd select strop struct termios time

Now run "make" to build the target: helloworld

keherman@ibmlnx20:/tmp$ make

gcc -pthread -Xlinker -export-dynamic config.o frozen.o
M_BaseHTTPServer.o M_FixTk.o M_SocketServer.o M_StringIo_O
M_Tkconstants.o M_Tkinter.o M_UserDict.o M___main__.o
M__threading_local.o M_atexit.o M_base64.o M_codecs.o M_copy.o
M_copy_reg.o M_dis.o M_distutils.o M_distutils__dep_util.o
M_distutils__errors.o M_distutils__log.o M_distutils__spawn.o
M_distutils__util.o M_dummy_thread.o M_email.o M_email__Charset.o
M_email__Encoders.o M_email__Errors.o M_email__FeedParser.o
M_email__Generator.o M_email__Header.o M_email__Iterators.o
M_email__Message.o M_email__Parser.o M_email__Utils.o
M_email___parseaddr.o M_email__base64MIME.o M_email__quopriMIME.o
M_encodings.o M_encodings__aliases.o M_fnmatch.o M_formatter.o
M_ftplib.o M_getopt.o M_getpass.o M_glob.o M_gopherlib.o M_gtk.o
M_gtk__keysyms.o M_htmlentitydefs.o M_htmllib.o M_httplib.o M_inspect.o
M_linecache.o M_locale.o M_macpath.o M_macurl2path.o M_markupbase.o
M_mimetools.o M_mimetypes.o M_ntpath.o M_nturl2path.o M_opcode.o M_os.o
M_os2emxpath.o M_popen2.o M_posixpath.o M_py_compile.o M_pydoc.o
M_pygtk.o M_quopri.o M_random.o M_re.o M_repr.o M_rfc822.o M_sgmllib.o
M_site.o M_socket.o M_sre.o M_sre_compile.o M_sre_constants.o
M_sre_parse.o M_stat.o M_string.o M_tempfile.o M_threading.o M_token.o
M_tokenize.o M_traceback.o M_tty.o M_types.o M_urllib.o M_urlparse.o
M_uu.o M_warnings.o M_webbrowser.o
/usr/lib/python2.4/config/libpython2.4.a -lpthread -ldl -lutil -lm
-o helloworld

/usr/lib/python2.4/config/libpython2.4.a(posixmodule.o): In function
`posix_tmpnam':

: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'

/usr/lib/python2.4/config/libpython2.4.a(posixmodule.o): In function
`posix_tempnam':

: warning: the use of `tempnam' is dangerous, better use `mkstemp'

keherman@ibmlnx20:/tmp$ ./helloworld

Traceback (most recent call last):

File "helloworld.py", line 5, 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
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

from _gtk import *

ImportError: No module named _gtk

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
 

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,962
Messages
2,570,134
Members
46,690
Latest member
MacGyver

Latest Threads

Top