473,543 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_loca l
/usr/local/lib/python2.4/_threading_loca l.py
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_u til
m distutils.error s
m distutils.log /usr/local/lib/python2.4/distutils/log.py
m distutils.spawn /usr/local/lib/python2.4/distutils/spawn.py
m distutils.sysco nfig
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.FeedParse r
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._parseadd r
m email.base64MIM E
m email.quopriMIM E
P encodings
m encodings.alias es
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.p y
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.sysco nfig, 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_loca l ...
freezing atexit ...
freezing base64 ...
freezing codecs ...
freezing copy ...
freezing copy_reg ...
freezing dis ...
freezing distutils ...
freezing distutils.dep_u til ...
freezing distutils.error s ...
freezing distutils.log ...
freezing distutils.spawn ...
freezing distutils.sysco nfig ...
freezing distutils.text_ file ...
freezing distutils.util ...
freezing dummy_thread ...
freezing email ...
freezing email.Charset ...
freezing email.Encoders ...
freezing email.Errors ...
freezing email.FeedParse r ...
freezing email.Generator ...
freezing email.Header ...
freezing email.Iterators ...
freezing email.Message ...
freezing email.Parser ...
freezing email.Utils ...
freezing email._parseadd r ...
freezing email.base64MIM E ...
freezing email.quopriMIM E ...
freezing encodings ...
freezing encodings.alias es ...
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 3166
jm*****@optio.c om 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 available. The apps with problems hit our SQL Server 2K across the network. We've had occasions where we get Timeout Expired errors in some of our ASP apps, and non-ASP vendor apps on separate servers...
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 (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather...
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 would impact our users (we normally release code changes once a month). Any suggestions on how to manage a partial code freeze while under going a major migration like this one?
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 front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can...
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 their use. Furthermore, some of them depend on each other. On my application startup, I configure the objects usting the RemotingConfiguration class to load the config file. Then I "ping" each of the...
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 application Thank you.
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 about modules, though. I want to make sure that my native executable is entirely standalone. That is, it should have no dynamic linking. I've read through a number of posts on the subject, and...
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. These modules are available in the dyn-load directory and I can import them from the python interpreter. Warning: unknown modules remain: _bisect _heapq _locale _random _socket Make also runs fine,...
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. This page calls a methode in a object of my page. I have opened the child.htm in a popup, so by opener.API the child.htm page can user the methodes which was defined in my API Obnject on...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.