[Pythonmac-SIG] Python that ships with Jaguar vs...

bill fancher bfancher@mac.com
Wed, 11 Sep 2002 13:55:18 -0700


On Wednesday, September 11, 2002, at 11:02 AM, christopher ariza wrote:

>
> while we are on the issue of the jaguar python, it seems that
> xml.dom.minidom is broken in the python that apple ships:
>
> [GCC Apple cpp-precomp 6.14] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import xml.dom.minidom
>>>> doc = xml.dom.minidom.parseString("<doc>my document.</doc>")
>
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>    File
> "/BinaryCache/python/python-3.root~193/usr/lib/python2.2/xml/dom/
> minidom.py", line 965, in parseString
>    File
> "/BinaryCache/python/python-3.root~193/usr/lib/python2.2/xml/dom/
> minidom.py", line 951, in _doparse
>    File
> "/BinaryCache/python/python-3.root~193/usr/lib/python2.2/xml/dom/
> pulldom.py", line 340, in parseString
>    File
> "/BinaryCache/python/python-3.root~193/usr/lib/python2.2/xml/sax/
> __init__.py", line 93, in make_parser
> xml.sax._exceptions.SAXReaderNotAvailable: No parsers found
>>>>
>
> can somebody with 10.2 test this for me?

I get the same thing here.

>  what is this /BinaryCache?

It's apparently an artifact of the build process. All the pyc and pyo 
files have this embedded. Recompiling the scripts in /usr/lib/python2.2 
results in the paths you'd expect, but the error persists.

>  i dont
> have 10.2 yet so i have this information from someone else. eitherway, 
> i
> was under the impression that xml.dom.minidom was standard python: this
> works in win, MacPython, and macho-python. can anyone tell me why it 
> would
> not work in what is supposed to be a 'standard' unix build? many 
> thanks.

I certainly can't. "import xml.sax.expatreader" works OK, and it 
appears that expatreader is in fact what it's looking for. Running the 
problem command a second time gets a different error:

 >>> doc = xml.dom.minidom.parseString("<doc>my document.</doc>")
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/usr/lib/python2.2/xml/dom/minidom.py", line 965, in parseString
     return _doparse(pulldom.parseString, args, kwargs)
   File "/usr/lib/python2.2/xml/dom/minidom.py", line 951, in _doparse
     events = apply(func, args, kwargs)
   File "/usr/lib/python2.2/xml/dom/pulldom.py", line 340, in parseString
     parser = xml.sax.make_parser()
   File "/usr/lib/python2.2/xml/sax/__init__.py", line 81, in make_parser
     return _create_parser(parser_name)
   File "/usr/lib/python2.2/xml/sax/__init__.py", line 106, in 
_create_parser
     return drv_module.create_parser()
AttributeError: 'module' object has no attribute 'create_parser'

OTOH, it works OK with 2.3. Don't have time to look into this further 
at the moment.

HTH,
--
bill