Python and freeze (something odd)

Discussion in 'Python' started by Aki Niimura, Jul 9, 2003.

  1. Aki Niimura

    Aki Niimura Guest

    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)
    Aki Niimura, Jul 9, 2003
    #1
    1. Advertising

  2. Aki Niimura

    Alan Kennedy Guest

    Aki Niimura wrote:

    > 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,

    --
    alan kennedy
    -----------------------------------------------------
    check http headers here: http://xhaus.com/headers
    email alan: http://xhaus.com/mailto/alan
    Alan Kennedy, Jul 10, 2003
    #2
    1. Advertising

  3. Aki Niimura

    Aki Niimura Guest

    Alan Kennedy <> wrote in message
    > 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
    Aki Niimura, Jul 10, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aki Niimura

    Python and freeze (something odd)

    Aki Niimura, Jul 9, 2003, in forum: Python
    Replies:
    0
    Views:
    320
    Aki Niimura
    Jul 9, 2003
  2. Frederik
    Replies:
    2
    Views:
    347
    Kevin Cazabon
    Jul 28, 2003
  3. Andrew Robert
    Replies:
    3
    Views:
    790
    Andrew Robert
    May 18, 2006
  4. Michael Speer

    Odd behavior with odd code

    Michael Speer, Feb 16, 2007, in forum: C Programming
    Replies:
    33
    Views:
    1,062
    Richard Heathfield
    Feb 18, 2007
  5. Replies:
    5
    Views:
    231
    Olivier Renaud
    Mar 15, 2007
Loading...

Share This Page