Python and freeze (something odd)

A

Aki Niimura

Hello Everyone,

I feel sorry to bother you guys as I posted another yesterday, too.

Finally my script which accesses a web site from a Python script is functioning
fully. It works very nicely (upload / download / does operations).

Now I'm trying to "freeze" my script to a single executable file under Solaris
using freeze. I have done such many times and it worked magically (until now).

However, maybe I'm out of luck.

When I started the generated executable, I got the following:
Traceback (most recent call last):
File "websc.py", line 284, in ?
File "websc.py", line 276, in main
File "websc.py", line 125, in upload_files
File "websc_upload.py", line 173, in httprequest
File "/usr/local/lib/python2.2/email/Message.py", line 113, in as_string
g.flatten(self, unixfrom=unixfrom)
File "/usr/local/lib/python2.2/email/Generator.py", line 103, in flatten
self._write(msg)
File "/usr/local/lib/python2.2/email/Generator.py", line 131, in _write
self._dispatch(msg)
File "/usr/local/lib/python2.2/email/Generator.py", line 157, in _dispatch
meth(msg)
File "/usr/local/lib/python2.2/email/Generator.py", line 231, in _handle_multipart
g.flatten(part, unixfrom=False)
File "/usr/local/lib/python2.2/email/Generator.py", line 103, in flatten
self._write(msg)
File "/usr/local/lib/python2.2/email/Generator.py", line 138, in _write
self._write_headers(msg)
File "/usr/local/lib/python2.2/email/Generator.py", line 172, in _write_headers
elif _is8bitstring(v):
File "/usr/local/lib/python2.2/email/Generator.py", line 44, in _is8bitstring
unicode(s, 'us-ascii')
LookupError: unknown encoding: us-ascii

//

As I mentioned earlier, it works fine if it is invoked from .py files.
Also, I created a simple test program which just does unicode(s, 'us-ascii').
The frozen version of such test program works without a hitch.

Guido mentioned in a document for 'freeze' saying:
"... It may still be confused -- it will not
know about calls to the __import__ built-in function, ..."

I guess my program confused 'freeze' as unicode is a built-in function.
However, he didn't offer any further information.

Any thoughts, any suggestions?

Thanks in advance.

Best regards,
Aki Niimura

(This is a repost as my previous posting seemed ignored)
 
A

Alan Kennedy

Aki said:
I'm trying to "freeze" my script to a single executable file under
Solaris using freeze. I have done such many times and it worked
magically (until now).
When I started the generated executable, I got the following:
File "/usr/local/lib/python2.2/email/Generator.py", line 44, in
_is8bitstring
[Snip]

unicode(s, 'us-ascii')
LookupError: unknown encoding: us-ascii


I think this might be related to a problem that existed in many
embedding situations. Check this bug on sourceforge

[663074]: codec registry and Python embedding problem
https://sourceforge.net/tracker/?func=detail&aid=663074&group_id=5470&atid=105470

I had a similar problem with mod_python and python 2.2.2. I upgraded
to python 2.2.3, and the problem just went away.

So it's probably worth upgrading to 2.2.3, and see if that fixes the
problem?

HTH,
 
A

Aki Niimura

Alan Kennedy said:
I think this might be related to a problem that existed in many
embedding situations. Check this bug on sourceforge

[663074]: codec registry and Python embedding problem
https://sourceforge.net/tracker/?func=detail&aid=663074&group_id=5470&atid=105470

I had a similar problem with mod_python and python 2.2.2. I upgraded
to python 2.2.3, and the problem just went away.

So it's probably worth upgrading to 2.2.3, and see if that fixes the
problem?

Alan, thank you very much for your kind posting.
I'm very surprised to hear a similar problem has existed.
Unfortunately, I have already python 2.2.3. No stable version to upgrade.
However, the bug info gave me many places to start.
I definitely look into this further.

Thanks!
Aki Niimura
 

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,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top