[Pythonmac-SIG] Working with Bundlebuilder.py

Kevin Ollivier kevino@tulane.edu
Tue, 8 Apr 2003 11:25:18 -0700


Hi all,

I've been working with the latest version of bundlebuilder.py, but  
recently I've been having trouble with the PyXML package. When I run  
the script using PythonLauncher, everything starts up fine, but when I  
try to run the .app bundle created by bundlebuilder.py, I'm getting  
errors about xml.parsers.expat.ParserCreate() not being available. I've  
added both _xmlplus and xml to the list of explicitly named packages to  
import, but with no success. (Although interestingly enough, if I add  
the xml package I get errors about the Sax parser not being available  
instead of the expat messages.) (P.S. Robin, I am not importing  
wxPython.xrc.)

I think it actually has something to do with PyXML's import magic. It  
replaces the xml module with their own _xmlplus module (possibly among  
other things), and I think that's causing confusion during the module  
finding/import process. (It could even be adding xmlplus on top of the  
existing xml module, so at runtime they are treated as one module.)

I thought it's also worth mentioning that McMillan's Installer program  
(which I use for the Windows version of my app) has about 9 different  
import hooks to make PyXML work. Is there any similar 'hooks' mechanism  
for Python's modulefinder.py or for bundlebuilder.py? Also, if anyone  
has any other Python tools for reading/writing XML that work well, and  
hopefully support XPath, I'm all ears. =) (Although I still want to get  
this import stuff fixed!)

Here is the traceback:

Traceback (most recent call last):
   File  
"/Users/kevino/oss/EClass/eclass_builder/build/EClass.Builder.app/ 
Contents/Resources/editor.py", line 2377, in ?
     app = MyApp(0)
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/wxPython/wx.py", line 1802, in __init__
     _wxStart(self.OnInit)
   File  
"/Users/kevino/oss/EClass/eclass_builder/build/EClass.Builder.app/ 
Contents/Resources/editor.py", line 2372, in OnInit
     self.frame = MainFrame2(NULL, -1, "EClass.Builder")
   File  
"/Users/kevino/oss/EClass/eclass_builder/build/EClass.Builder.app/ 
Contents/Resources/editor.py", line 156, in __init__
     self.settings.LoadFromXML(os.path.join(prefdir, "settings.xml"))
   File  
"/Users/kevino/oss/EClass/eclass_builder/conman/xml_settings.py", line  
50, in LoadFromXML
     doc = FromXmlFile(filename)
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/_xmlplus/dom/ext/reader/Sax.py", line 160, in FromXmlFile
     saxHandlerClass, parser)
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/_xmlplus/dom/ext/reader/Sax.py", line 143, in FromXmlStream
     reader = Reader(validate, keepAllWs, catName, saxHandlerClass,  
parser)
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/_xmlplus/dom/ext/reader/Sax.py", line 118, in __init__
     self.parser = parser or (validate and  
saxexts.XMLValParserFactory.make_parser()) or  
saxexts.XMLParserFactory.make_parser()
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/_xmlplus/sax/saxexts.py", line 64, in make_parser
     return self._create_parser(parser_name)
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/_xmlplus/sax/saxexts.py", line 43, in _create_parser
     return drv_module.create_parser()
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/_xmlplus/sax/drivers/drv_pyexpat.py", line 227, in  
create_parser
     return SAX_expat()
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/_xmlplus/sax/drivers/drv_pyexpat.py", line 31, in __init__
     self.reset()
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/_xmlplus/sax/drivers/drv_pyexpat.py", line 117, in reset
     self.parser=expat.ParserCreate()
AttributeError: 'module' object has no attribute 'ParserCreate'
warning: use func(*args, **kwargs) instead of apply(func, args, kwargs)

Thanks,

Kevin