473,740 Members | 7,355 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
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
/usr/local/lib/python2.4/lib-tk/Tkconstants.py
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
/usr/local/lib/python2.4/lib-dynload/_locale.so
m _random
/usr/local/lib/python2.4/lib-dynload/_random.so
m _socket
/usr/local/lib/python2.4/lib-dynload/_socket.so
m _sre
m _threading_loca l
/usr/local/lib/python2.4/_threading_loca l.py
m array
/usr/local/lib/python2.4/lib-dynload/array.so
m atexit /usr/local/lib/python2.4/atexit.py
m base64 /usr/local/lib/python2.4/base64.py
m binascii
/usr/local/lib/python2.4/lib-dynload/binascii.so
m cStringIO
/usr/local/lib/python2.4/lib-dynload/cStringIO.so
m codecs /usr/local/lib/python2.4/codecs.py
m collections
/usr/local/lib/python2.4/lib-dynload/collections.so
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
/usr/local/lib/python2.4/distutils/__init__.py
m distutils.dep_u til
/usr/local/lib/python2.4/distutils/dep_util.py
m distutils.error s
/usr/local/lib/python2.4/distutils/errors.py
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
/usr/local/lib/python2.4/distutils/sysconfig.py
m distutils.text_ file
/usr/local/lib/python2.4/distutils/text_file.py
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
/usr/local/lib/python2.4/email/FeedParser.py
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
/usr/local/lib/python2.4/email/_parseaddr.py
m email.base64MIM E
/usr/local/lib/python2.4/email/base64MIME.py
m email.quopriMIM E
/usr/local/lib/python2.4/email/quopriMIME.py
P encodings
/usr/local/lib/python2.4/encodings/__init__.py
m encodings.alias es
/usr/local/lib/python2.4/encodings/aliases.py
m errno
m exceptions
m fcntl
/usr/local/lib/python2.4/lib-dynload/fcntl.so
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
/usr/local/lib/python2.4/lib-dynload/itertools.so
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
/usr/local/lib/python2.4/lib-dynload/math.so
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
/usr/local/lib/python2.4/lib-dynload/select.so
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
/usr/local/lib/python2.4/lib-dynload/strop.so
m struct
/usr/local/lib/python2.4/lib-dynload/struct.so
m sys
m tempfile /usr/local/lib/python2.4/tempfile.py
m termios
/usr/local/lib/python2.4/lib-dynload/termios.so
m thread
m threading /usr/local/lib/python2.4/threading.py
m time
/usr/local/lib/python2.4/lib-dynload/time.so
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
time
Now run "make" in xfer to build the target: xfer

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

# ./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 !!!

Sincerely,
John Malone
Optio Software, Inc.

Dec 22 '06 #1
1 3183
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
/usr/local/lib/python2.4/lib-dynload/_locale.so
m _random
/usr/local/lib/python2.4/lib-dynload/_random.so
m _socket
/usr/local/lib/python2.4/lib-dynload/_socket.so
m array
/usr/local/lib/python2.4/lib-dynload/array.so
m binascii
/usr/local/lib/python2.4/lib-dynload/binascii.so
[...]
generating table of frozen modules
Warning: unknown modules remain: _locale _random _socket array binascii
cStringIO collections fcntl itertools math select strop struct termios
time
Now run "make" in xfer to build the target: xfer

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

# ./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'.

HTH,
n

Dec 23 '06 #2

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

Similar topics

1
1940
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 that hit the SQL Server get into the same problem of hourglassing and not coming back. When the...
121
10129
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 than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
2
1905
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?
19
4107
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 easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
11
2768
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 objects to call their constructors. This all works fine if no one is attempting to connect at the...
6
3430
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.
2
1417
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 think I get it. In order to make this work, I need to do two things: (1) Recompile libpythonXXX.a so...
0
1082
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, but when I run the program on another machine, it compiles saying could not import these modules....
4
7031
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 (parent.htm). On my parent.htm, with i can edit, the called methode "sendValue" open a sync HTTPRequest and will...
0
9484
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9342
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9272
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9211
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8218
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4572
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3286
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
3
2195
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.