Importing XML modules in py2exe or Installer?

Gustaf Liljegren gustafl at algonet.se
Sat Jul 14 20:59:20 EDT 2001


Gordon McMillan <gmcm at hypernet.com> wrote:

>So put the line
>packages=_xmlplus 
>in the APPZLIB section.

Okay, now I used Standalone first. Got a .cfg file and changed it according 
to the above. Then I ran in again with Builder. Is this really the normal 
operation? I had expected to first make a config file and then make an exe, 
or that you would get an opportunity to save the modified config file and 
run Standalone on it again. But I guess this is a special case, and the 
second run is normally not needed.

When I run Builder, I get the following two warnings (among many others 
that seem non-significant):

W: __import__ hack detected at line 54 of xml.dom.domreg
W: __import__ hack detected at line 100 of xml.sax

Does this mean that the import of the XML modules wasn't successful?

My script needs a special config file, written in XML, in the same 
directory as the script itself. I was happy to see that before I had added 
the XML file to this directory, jane.exe complained in the right way:

E:\python\gustaf\dist_jane>jane
No profiles file found.

However, when I add the XML file to the directory, it fails:

E:\python\gustaf\dist_jane>jane
Traceback (most recent call last):
  File "<string>", line 54, in ?
  File "e:\python\gustaf\friend.py", line 19, in __init__
    self.profile = self.load()
  File "e:\python\gustaf\friend.py", line 31, in load
    doc = parse(self.file)
  File "e:\python\_xmlplus\dom\minidom.py", line 839, in parse
    return _doparse(pulldom.parse, args, kwargs)
  File "e:\python\_xmlplus\dom\minidom.py", line 830, in _doparse
    events = apply(func, args, kwargs)
  File "e:\python\_xmlplus\dom\pulldom.py", line 288, in parse
    parser = xml.sax.make_parser()
  File "e:\python\_xmlplus\sax\sax2exts.py", line 34, in make_parser
    return XMLParserFactory.make_parser(parser_list)
  File "e:\python\_xmlplus\sax\saxexts.py", line 75, in make_parser
    sys.modules[parser_name].create_parser = _create_parser
KeyError: xml.sax.drivers2.drv_pyexpat

I take it as a sign that the XML modules can't be found. Is there anything 
I can do to facilitate the search for extra modules? Have already tried to 
use an absolute path.

Regards,

Gustaf Liljegren



More information about the Python-list mailing list