Importing XML modules in py2exe or Installer?

Gustaf Liljegren gustafl at algonet.se
Sat Jul 14 21:18:52 EDT 2001


"Thomas Heller" <thomas.heller at ion-tof.com> wrote:

>The correct py2exe command line would be (assuming your script is
>named setup.py):
>'python setup.py py2exe -p _xmlplus'
>to include the whole _xmlplus package.
>
>Hope this helps,

It did, but I encountered a horrible thing instead (scary, dissonant music 
starts) -- an encoding problem! (screams) I'm don't know how to continue, 
and not much of an idea about what pieces of information you would need to 
solve it. The script works from Python, but not from the execuable...

If you read the Installer thread, you read this:

--
My script needs a special config file, written in XML, in the same 
directory as the script itself. I was happy to see that before I had added 
the XML file to this directory, jane.exe complained in the right way:

E:\python\gustaf\dist_jane>jane
No profiles file found.
--

This accounts to py2exe aswell. But when adding the XML file, I get this 
error:

E:\jane>jane
Traceback (most recent call last):
  File "<string>", line 54, in ?
  File "friend.pyc", line 22, in __init__
  File "friend.pyc", line 49, in getName
LookupError: unknown encoding

This has probably something to do with the fact that the XML modules use 
UTF-8 by default. But the class that import info from this XML file, 
converts everything to 'latin1' before sending it further to the other 
functions (how nice it would be if Python could handle this transparently), 
so this error must take place before this conversion. Could it be that my 
Windows 98 doesn't know about UTF-8?

Regards,

Gustaf Liljegren



More information about the Python-list mailing list