[Pythonmac-SIG] parsing system_profiler xml output
bob at redivi.com
Thu Nov 11 21:45:17 CET 2004
On Nov 11, 2004, at 15:32, eichin at metacarta.com wrote:
>> format" is probably really plist, since that's the DTD referred to in
>> system_profiler output. Maybe there's a way to do this using plistlib
> plistlib as-shipped is missing a bunch of things; system profiler
> output fails on
> python2.3/plat-mac/plistlib.py", line 356, in begin_array
> python2.3/plat-mac/plistlib.py", line 326, in addObject
> assert self.root is value
If this doesn't work with Python 2.4's plistlib, then the output of
system profiler is not correct. I'm at least 90% sure that Python
2.4's plistlib correctly reads and writes all valid plists.
> which I've seen before but not traced. iTunes plist importing also
> fails, but that's due to:
>>>> from xml.utils.iso8601 import parse
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> ImportError: No module named utils.iso8601
> in plistlib.Date.__init__ and toString. That's at least easy to
> kludge around - just copy the definition of plistlib.Date, and make it
> pass the date strings back as strings.
plistlib.Date, among other things, was broken before Python 2.4b2, even
if you had PyXML installed. Get the version from Python 2.4. (it is
> (as for the other part, Python's XML story is wierd - when PyXML is
> installed it drops some new things into the xml namespace, so having
> "import xml" work doesn't actually tell you anything useful.)
import _xmlplus is the correct way to detect the presence of PyXML.
More information about the Pythonmac-SIG