473,320 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Effbot's SimpleXMLWriter fails when py2exe'd

Hello All,

So I have been using Effbot's XML stuff a lot! And I have been using
py2exe, pygame and wxPython all mixed together...

I am getting this strange error log when writing XML files with his XML
writer. It appears to be fouling up on the encoding, ONLY in the exe
version. Runs fine and great as a python script.

What this does is leave the file hanging open...

I could write out the XML myself, but I would rather use his class...
any ideas why it broke?

Thank you,
-Erik

code snippet:
def SaveVocabTree( self ):
ElementTree( self.vocabXMLTree ).write(self.currentPath,
encoding='utf-8')

error log:
Traceback (most recent call last):
File "vocab.py", line 457, in OnAdd
File "vocab.py", line 483, in AddWord
File "vocab.py", line 494, in SaveVocabTree
File "elementtree\ElementTree.pyc", line 666, in write
File "elementtree\ElementTree.pyc", line 684, in _write
File "elementtree\ElementTree.pyc", line 754, in _encode
LookupError: unknown encoding: utf-8

Jul 18 '05 #1
3 1866
On Tue, 08 Feb 2005 08:35:51 -0800 (PST), Erik Bethke
<er********@gmail.com> wrote:
I am getting this strange error log when writing XML files with his XML
writer. It appears to be fouling up on the encoding, ONLY in the exe
version. Runs fine and great as a python script.


<http://starship.python.net/crew/theller/moin.cgi/EncodingsAgain>

--
Cheers,
Simon B,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Jul 18 '05 #2
Erik Bethke wrote:
So I have been using Effbot's XML stuff a lot! And I have been using
py2exe, pygame and wxPython all mixed together...

I am getting this strange error log when writing XML files with his XML
writer. It appears to be fouling up on the encoding, ONLY in the exe
version. Runs fine and great as a python script.


you need to explicitly tell py2exe to include the relevant encodings
(from the encodings package in the standard library). adding a simple

import encodings.utf_8

to your script might help. if not, see the following wiki page:

http://starship.python.net/crew/thel...EncodingsAgain

</F>

Jul 18 '05 #3
Awesome!

Great thank you both, fixed!

-Erik

Jul 18 '05 #4

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

Similar topics

2
by: kogrover | last post by:
ISSUE: COM Excel Sort works with Early Binding, but not Late Binding, but py2exe only does Late Binding I have code similar to this (type from notes, so there may be a typo...) import...
1
by: peterbe | last post by:
I'll try to explain my problem with code. The problem is the output msg = u"Södertälje & Borås" # latin1 unicode string with a & from elementtree.SimpleXMLWriter import XMLWriter from...
5
by: msunderwd | last post by:
Having a problem with "compiling" a Tkinter/python program using py2exe (and pyinstaller, for that matter)... I have several dialogs that are derived from the tkSimpleDialog.Dialog class. These...
5
by: Doug Morse | last post by:
Hi, I have an application that runs just fine using the standard Python distro interpreter (v2.5.1 on WinXP) but throws the following exception when run as an executable built with py2exe. My...
6
by: Python Programming on Win32 | last post by:
Hi, I have encountered a problem which I can not figure out a solution to. Tried Googeling it, but to no help unfortunately. The problem is running smtplib in a py2exe compiled exe file. When...
1
by: Jimmy Retzlaff | last post by:
py2exe 0.6.8 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: Larry Bates | last post by:
Jimmy Retzlaff wrote: Everyone, Thanks for all your hard work on py2exe, it is greatly appreciated. -Larry Bates
5
by: Alexnb | last post by:
Hello I am sure most of you are familiar with py2exe. I am having a bit of a problem. See the program has a few pictures involved and the .ico it uses for the windows. However, the pictures are...
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.9 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.