472,334 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

Using Tools/freeze.py on AIX -- having problems

I have a python script that I need to freeze on AIX 5.1 (customer has
AIX and does not want to install Python). The python script is pretty
simple (the only things it imports are sys and socket).

The README file in the Tools/freeze directory of the Python-2.4.4
distribution says the following (and many other things):

Previous versions of Freeze used a pretty simple-minded algorithm to
find the modules that your program uses, essentially searching for
lines starting with the word "import". It was pretty easy to trick it
into making mistakes, either missing valid import statements, or
mistaking string literals (e.g. doc strings) for import statements.

This has been remedied: Freeze now uses the regular Python parser to
parse the program (and all its modules) and scans the generated byte
code for IMPORT instructions. It may still be confused -- it will not
know about calls to the __import__ built-in function, or about import
statements constructed on the fly and executed using the 'exec'
statement, and it will consider import statements even when they are
unreachable (e.g. "if 0: import foobar").

This new version of Freeze also knows about Python's new package
import mechanism, and uses exactly the same rules to find imported
modules and packages. One exception: if you write 'from package
import *', Python will look into the __all__ variable of the package
to determine which modules are to be imported, while Freeze will do a
directory listing.

One tricky issue: Freeze assumes that the Python interpreter and
environment you're using to run Freeze is the same one that would be
used to run your program, which should also be the same whose sources
and installed files you will learn about in the next section. In
particular, your PYTHONPATH setting should be the same as for running
your program locally. (Tip: if the program doesn't run when you type
"python hello.py" there's little chance of getting the frozen version
to run.)

I have installed Python-2.4.4 on AIX using the procedure:

(logged in as root)
../configure --disable-ipv6 --disable-shared
make test
make install

The compiler being used during this process is: VisualAge C++
Professional / C for AIX Compiler, Version 6.

Python seems to install correctly for the most part ("make test" gives
a few messages about things that are not quite right (3 failed tests
(test_mmap, test_pty, & test_resource) and 2 unexpectedly skipped
(test_curses & test_largefile)), but nothing major (all the normal
stuff, including test_socket and test_sys, passed)). Also, the
unfrozen version of the script seems to run properly on the Python
interpreter after installation.

After this paragraph follows the output from the freeze. The biggest
problem is the part at the bottom "Warning: unknown modules remain:".
Neither of the suggestions in the README file in the Tools/freeze
directory about this warning message have proven helpful.

Name File
---- ----
m BaseHTTPServer /usr/local/lib/python2.4/BaseHTTPServer.py
m FixTk /usr/local/lib/python2.4/lib-tk/FixTk.py
m SocketServer /usr/local/lib/python2.4/SocketServer.py
m StringIO /usr/local/lib/python2.4/StringIO.py
m Tkconstants
m Tkinter /usr/local/lib/python2.4/lib-tk/Tkinter.py
m UserDict /usr/local/lib/python2.4/UserDict.py
m __builtin__
m __main__ xfer.py
m _codecs
m _locale
m _random
m _socket
m _sre
m _threading_local
m array
m atexit /usr/local/lib/python2.4/atexit.py
m base64 /usr/local/lib/python2.4/base64.py
m binascii
m cStringIO
m codecs /usr/local/lib/python2.4/codecs.py
m collections
m copy /usr/local/lib/python2.4/copy.py
m copy_reg /usr/local/lib/python2.4/copy_reg.py
m dis /usr/local/lib/python2.4/dis.py
P distutils
m distutils.dep_util
m distutils.errors
m distutils.log /usr/local/lib/python2.4/distutils/log.py
m distutils.spawn /usr/local/lib/python2.4/distutils/spawn.py
m distutils.sysconfig
m distutils.text_file
m distutils.util /usr/local/lib/python2.4/distutils/util.py
m dummy_thread /usr/local/lib/python2.4/dummy_thread.py
P email /usr/local/lib/python2.4/email/__init__.py
m email.Charset /usr/local/lib/python2.4/email/Charset.py
m email.Encoders /usr/local/lib/python2.4/email/Encoders.py
m email.Errors /usr/local/lib/python2.4/email/Errors.py
m email.FeedParser
m email.Generator /usr/local/lib/python2.4/email/Generator.py
m email.Header /usr/local/lib/python2.4/email/Header.py
m email.Iterators /usr/local/lib/python2.4/email/Iterators.py
m email.Message /usr/local/lib/python2.4/email/Message.py
m email.Parser /usr/local/lib/python2.4/email/Parser.py
m email.Utils /usr/local/lib/python2.4/email/Utils.py
m email._parseaddr
m email.base64MIME
m email.quopriMIME
P encodings
m encodings.aliases
m errno
m exceptions
m fcntl
m fnmatch /usr/local/lib/python2.4/fnmatch.py
m formatter /usr/local/lib/python2.4/formatter.py
m ftplib /usr/local/lib/python2.4/ftplib.py
m getopt /usr/local/lib/python2.4/getopt.py
m getpass /usr/local/lib/python2.4/getpass.py
m glob /usr/local/lib/python2.4/glob.py
m gopherlib /usr/local/lib/python2.4/gopherlib.py
m htmlentitydefs /usr/local/lib/python2.4/htmlentitydefs.py
m htmllib /usr/local/lib/python2.4/htmllib.py
m httplib /usr/local/lib/python2.4/httplib.py
m imp
m inspect /usr/local/lib/python2.4/inspect.py
m itertools
m linecache /usr/local/lib/python2.4/linecache.py
m locale /usr/local/lib/python2.4/locale.py
m macpath /usr/local/lib/python2.4/macpath.py
m macurl2path /usr/local/lib/python2.4/macurl2path.py
m markupbase /usr/local/lib/python2.4/markupbase.py
m marshal
m math
m mimetools /usr/local/lib/python2.4/mimetools.py
m mimetypes /usr/local/lib/python2.4/mimetypes.py
m ntpath /usr/local/lib/python2.4/ntpath.py
m nturl2path /usr/local/lib/python2.4/nturl2path.py
m opcode /usr/local/lib/python2.4/opcode.py
m os /usr/local/lib/python2.4/os.py
m os2emxpath /usr/local/lib/python2.4/os2emxpath.py
m popen2 /usr/local/lib/python2.4/popen2.py
m posix
m posixpath /usr/local/lib/python2.4/posixpath.py
m pwd
m py_compile /usr/local/lib/python2.4/py_compile.py
m pydoc /usr/local/lib/python2.4/pydoc.py
m quopri /usr/local/lib/python2.4/quopri.py
m random /usr/local/lib/python2.4/random.py
m re /usr/local/lib/python2.4/re.py
m repr /usr/local/lib/python2.4/repr.py
m rfc822 /usr/local/lib/python2.4/rfc822.py
m select
m sgmllib /usr/local/lib/python2.4/sgmllib.py
m site /usr/local/lib/python2.4/site.py
m socket /usr/local/lib/python2.4/socket.py
m sre /usr/local/lib/python2.4/sre.py
m sre_compile /usr/local/lib/python2.4/sre_compile.py
m sre_constants /usr/local/lib/python2.4/sre_constants.py
m sre_parse /usr/local/lib/python2.4/sre_parse.py
m stat /usr/local/lib/python2.4/stat.py
m string /usr/local/lib/python2.4/string.py
m strop
m struct
m sys
m tempfile /usr/local/lib/python2.4/tempfile.py
m termios
m thread
m threading /usr/local/lib/python2.4/threading.py
m time
m token /usr/local/lib/python2.4/token.py
m tokenize /usr/local/lib/python2.4/tokenize.py
m traceback /usr/local/lib/python2.4/traceback.py
m tty /usr/local/lib/python2.4/tty.py
m types /usr/local/lib/python2.4/types.py
m urllib /usr/local/lib/python2.4/urllib.py
m urlparse /usr/local/lib/python2.4/urlparse.py
m uu /usr/local/lib/python2.4/uu.py
m warnings /usr/local/lib/python2.4/warnings.py
m webbrowser /usr/local/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, distutils.sysconfig, py_compile
? SOCKS imported from ftplib
? _emx_link imported from os
? _ssl imported from socket
? _tkinter imported from FixTk, Tkinter
? _winreg imported from urllib
? ce imported from os
? ic imported from pydoc, urllib, webbrowser
? 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.sysconfig ...
freezing distutils.text_file ...
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 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 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 array binascii
cStringIO collections fcntl itertools math select strop struct termios
Now run "make" in xfer to build the target: xfer

After running make, here is the result of trying to execute the frozen

# ./xfer
Traceback (most recent call last):
File "xfer.py", line 2, in ?
File "/usr/local/lib/python2.4/socket.py", line 45, in ?
import _socket
ImportError: No module named _socket

Any insight you can provide in regards to this problem would be greatly
appreciated !

Thanks !!!

John Malone
Optio Software, Inc.

Dec 22 '06 #1
1 3076
jm*****@optio.com wrote:
Python seems to install correctly for the most part ("make test" gives
a few messages about things that are not quite right (3 failed tests
(test_mmap, test_pty, & test_resource) and 2 unexpectedly skipped
Don't worry about these.
Name File
---- ----
m _locale
m _random
m _socket
m array
m binascii
generating table of frozen modules
Warning: unknown modules remain: _locale _random _socket array binascii
cStringIO collections fcntl itertools math select strop struct termios
Now run "make" in xfer to build the target: xfer

After running make, here is the result of trying to execute the frozen

# ./xfer
Traceback (most recent call last):
File "xfer.py", line 2, in ?
File "/usr/local/lib/python2.4/socket.py", line 45, in ?
import _socket
ImportError: No module named _socket
There's this note in freeze.py:

The script should not use modules provided only as shared libraries;
if it does, the resulting binary is not self-contained.

I don't really remember much about freeze. IIRC, you will also need to
copy the extension modules (I left them in above) in addition to
'xfer'. Try copying them into the same directory. You might need to
set LIBPATH=. (or whatever the env't var is). On most Unixes, the
env't var is LD_LIBRARY_PATH, but I recall AIX being different.

If you want, you can just copy all the files from lib-dynload along
with 'xfer'.


Dec 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: dw | last post by:
Hello, all. We've been having some issues with our web server, which has Win2K SP3, IIS 5, 2GB RAM, 2.4 GHz processor, and 130+ GB of storage...
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode...
by: aww91 | last post by:
Company is planning a Sybase to UDB migration that is projected to take 1 year. During that long period of time any Code Freeze put into place...
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a...
by: Timothy Shih | last post by:
Hi, I am having a freezing issue with my application. My application serves several remotable objects, all of which must be initialized before...
by: vaishnavnitin | last post by:
Hello Al I am re-designing 16-bit application of other party. but currently i don't have VC++ 1.52 I want to compile or debug the original 16-bit...
by: mrstephengross | last post by:
I'm working with the freeze utility, and I'm trying to learn the basics. For the most part, I think I understand how it works. I have a question...
by: jm.suresh | last post by:
I am trying to use freeze to create a single binary executable for one of my program. When I run freeze, it runs fine with the following modules....
by: ToxSox | last post by:
Hello. This is my first post here and i have a big problem with my script! One page (child.htm), was delivered not by me and i can't change it....
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.