PyXB 1.2.3 has now been released and is available for download from SourceForge and (supposedly) PyPI. Details of the release are here.
Those interested in Python 3 support can obtain a translated version from the git repository as documented in the release notes.
is the release broken for python 2.7?
namely, the following change doesn't seem to work for me.
>Author: Peter A. Bigot <email@example.com>
>Date: Fri Sep 13 13:18:54 2013 -0500
> python3: use x in d rather than has_key
the following is a trace on my environment.
AttributesNSImpl (from pyXML 0.8.4) has has_key but no __contains__.
Traceback (most recent call last):
File "/usr/pkg/lib/python2.7/pdb.py", line 1314, in main
File "/usr/pkg/lib/python2.7/pdb.py", line 1233, in _runscript
File "/usr/pkg/lib/python2.7/bdb.py", line 400, in run
exec cmd in globals, locals
File "<string>", line 1, in <module>
File "a.py", line 1, in <module>
import hoge.binding as o
File "hoge/binding.py", line 62, in CreateFromDocument
File "/home/takashi/.local/lib/python2.7/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse
File "/home/takashi/.local/lib/python2.7/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
File "/home/takashi/.local/lib/python2.7/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed
File "/home/takashi/.local/lib/python2.7/site-packages/_xmlplus/sax/expatreader.py", line 353, in start_element_ns
File "/home/takashi/.local/lib/python2.7/site-packages/pyxb/binding/saxer.py", line 330, in startElementNS
if self.__XSITypeTuple in attrs:
File "/home/takashi/.local/lib/python2.7/site-packages/_xmlplus/sax/xmlreader.py", line 316, in __getitem__
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
-> return self._attrs[name]
(Pdb) p self
<xml.sax.xmlreader.AttributesNSImpl instance at 0x7f7ff38a5320>
There are no known problems with PyXB on Python 2.7 that would express in that way. Either the problem comes from running it under pdb, or it's a bug in your program, or it's an unknown problem with PyXB.
Or it's a problem with whatever _xmlplus is or your python installation; normally I find those modules in /usr/lib/python2.7/xml/sax, not in sitepackages. Looks like you've got pyXML getting in the way.
indeed, it turned out to be pyXML installation problem.
(i had two instances of pyXML installed)
thanks for pointing out.
I am seeing that same KeyError exception (with the same stack trace) even with a single valid installation of PyXML. If I uninstall the PyXML package, my test driver (which simply does a set of "CreateFromDocument" calls on known binding types) works fine. If I install PyXML, I get this KeyError.
My setup is PyXB 1.2.3 on RHEL 6.4 x86_64 (python 2.6.6, PyXML 0.8.4). PyXB 1.1 is already working correctly on that same platform - I'm just seeing the error trying to upgrade to PyXB 1.2.
Removing PyXML isn't an option, since I have other code that depends on its xpath implementation. It also doesn't seem like there's a way to tell the builtin "xml" module not to look for _xmlplus (and just use the builtin sax implementation).
Sorry. AFAICT PyXML hasn't been updated since version 0.8.4 in November 2004; it's not available on pypi, and the web site says not to use the version that's still on sourceforge. So I can't reproduce the problem.
From your description I'm going to guess the issue is related to trac/224. If so, you may be able to fix it by using pyxb.utils.domutils.SetDOMImplementation() as described in the DR or with alternative arguments.
If that's not it, I'm afraid I can't really help you.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.