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

Tony Lownds tony@lownds.com
Wed, 11 Sep 2002 14:11:50 -0700


>>  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:

I can explain why it works the second time: import 
xml.sax.expatreader actually doesn't work, but if you run it twice 
you do not get an exception the second time. This is because there is 
a half-initialized module object in sys.modules['xml.sax.expatreader 
'] by the time the "expat not supprted" exception happens. When you 
import a second time the empty, half-initialized module is found in 
sys.modules.

Python 2.2 (#1, 07/14/02, 23:25:09)
[GCC Apple cpp-precomp 6.14] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>  import xml.sax.expatreader
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File 
"/BinaryCache/python/python-3.root~193/usr/lib/python2.2/xml/sax/expatreader.py", 
line 19, in ?
xml.sax._exceptions.SAXReaderNotAvailable: expat not supported
>>>  import xml.sax.expatreader
>>>

I guess that expat was not included in darwin because there are 
problems with the makefile in the canonical release of expat (on the 
author's homepage) - it didn't make a libexpat.a. That's also why 
expat was copied into the Python source tree, IIRC.

-Tony