Hi, I am starting a schema driven project and am operating on MS
Windows. I had started with generateDS but switched over to pyxb once I
got to facet/restriction handling. Most things have gone smoothly but I
had a couple of snags.
For the generation of wrapper files I saw the threads saying use "file:"
for pyxbgen which worked for me until I had sub schemas that were also
files. The second file's name was getting "file:///" prepended and
wasn't being found when I tried something like "pyxbgen -u
file:local.xsd -m local_out". I decided to check for the uri resulting
in a local file and didn't let the archive directory get modified in
that case.
My second issue was in using archived files for schemas using
namespaces. I would get an ImportError and it turns out that the
pickled file was written in mode "a+" and on windows that ends the lines
with "\r\n". When pickle would read the data the modules would have an
extra "\r" at the end of strings and lead to an error like this:
File
"c:\PydroTrunk\pydro\lib\site-packages\pyxb\namespace\archive.py", line
357, in __createUnpickler
self.__generationUID = unpickler.load()
ImportError: No module named utility
I changed line 608 of utils/utility to use append binary and things are
happy.
fp = file(file_name, 'ab+')
For the first issue I changed utils/utility.py at line 550 from:
try:
if 0 <= uri.find(':'):
xmls = urllib2.urlopen(uri).read()
else:
xmls = file(uri).read()
archive_directory = None
to:
try:
try:
f = urllib2.urlopen(uri)
except:
try:
import urllib
f = urllib.urlopen(uri) #urllib and urllib2 handle
slightly differently so let both try.
except:
f = file(uri)
xmls = f.read()
if isinstance(f, file) or isinstance(f.fp, file): #catch any
regular files or urllib files
archive_directory = None
Thanks for all the work you've put in so far,
bg
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
pyxb-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyxb-users