[XML-SIG] Using PyExpat.py

Don Wakefield don_wakefield@mentorg.com
Sat, 10 Feb 2001 10:52:20 -0800 (PST)

>>>>> "Martin" == Martin v Loewis <martin@loewis.home.cs.tu-berlin.de> writes:

Martin> I recommend to let the exception through instead of trying to
Martin> print it this way

Thanks. I tried that, and got the following traceback:

python_ic Timediag.py cs39.xml
Traceback (innermost last):
  File "Timediag.py", line 20, in ?
    x = Cells(sys.argv[1])
  File "Timediag.py", line 12, in __init__
    xml_dom_object = reader.fromStream(fp)
  File "/wv/icdet/python_src/12-19-00/BUILD_AREA/ss6/obj/lib/python1.5/site-packages/xml/dom/ext/reader/PyExpat.py", line 65, in fromStream
  File "/wv/icdet/python_src/12-19-00/BUILD_AREA/ss6/obj/lib/python1.5/site-packages/xml/dom/ext/reader/PyExpat.py", line 51, in initParser
NameError: pyexpat

But if I start python from the command line, I can do:

<47 : /user/donw/src/Demo/bigproto> python
Python 1.5.2 (#1, Dec 20 2000, 08:50:14)  [GCC 2.9-mentor-98r2p24] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from xml.parsers import pyexpat
>>> parser=pyexpat.ParserCreate() 
>>> ^D

So my environment is fine. PyExpat.py does not import pyexpat, but I do
in my calling test script:

  from xml.parsers import pyexpat
  from xml.dom.ext.reader import PyExpat

Martin> That's hard to say. First, a number of changes have been made since
Martin> 0.6.2; I can't reproduce your problem.

Note that I've downloaded PyXML-0.6.3 from Sourceforge (haven't
installed it yet) and PyExpat.py in *that* version does not import
pyexpat either. So if you are not able to duplicate the problem with
that version, it must be something deeper...

I'll try installing 0.6.3 and hammer on it for awhile. Note that I'm
able to build a DOM using the lines:

   from xml.dom import ext
   from xml.dom.ext.reader import Sax2
   xml_dom_object = Sax2.FromXmlFile(filename, validate=0)

I'm just hoping to build a DOM with expat to improve performance. Thanks
for any suggestions.

Don Wakefield                              Mentor Graphics Corporation
(503) 685-1262                             8005 S.W. Boeckman Road    
don_wakefield@mentorg.com                  Wilsonville, OR 97070-7777