Problem with wxpython and xml.sax

Hi,
I'm using wxpython in a project I'm working and know I've got the need
to parse a xml file, which is already done. I used the following code to
achieve it:

from xml.sax import saxlib, saxexts

parser = saxexts.make_parser()
handler = handler() -> method that creates my handler
parser.setDocumentHandler(handler)
parser.feed(input)
result = handler.getoutput()

When I use this separately, only in python it works fine. When I use it
within wxpython, I get a segmentation fault when creating the parser.
Has anyone ever had this problem?

I'm using wxPython-2.5.3.1 and python-2.4.

NOTE: this problem doesn't occur when I use wxPython-2.4.2.

Thanks!

JP

João Vilela wrote:

Hi,
I'm using wxpython in a project I'm working and know I've got the need
to parse a xml file, which is already done. I used the following code to
achieve it:

from xml.sax import saxlib, saxexts

parser = saxexts.make_parser()
handler = handler() -> method that creates my handler
parser.setDocumentHandler(handler)
parser.feed(input)
result = handler.getoutput()

When I use this separately, only in python it works fine. When I use it
within wxpython, I get a segmentation fault when creating the parser.
Has anyone ever had this problem?

I'm using wxPython-2.5.3.1 and python-2.4.

Which platform?

This sounds familiar and IIRC it is because wx also uses the expat lib and there is a version conflict between the one that wx uses and the one loaded by the xml modules. Try switching the order that the wx and xml packages are imported.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

João Vilela <jvilela@dcc.online.pt> writes:

Hi,
I'm using wxpython in a project I'm working and know I've got the need
to parse a xml file, which is already done.

[...]

When I use this separately, only in python it works fine. When I use it
within wxpython, I get a segmentation fault when creating the parser.
Has anyone ever had this problem?

You're probably running into this bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=1075984&group_id=5470&atid=105470

   Bernhard

···

--
Intevation GmbH http://intevation.de/
Skencil http://skencil.org/
Thuban http://thuban.intevation.org/