[python-win32] Problems with XML COM server

Thomas Heller theller at python.net
Wed Jul 6 12:25:42 CEST 2005


Stephen Dicks <stephen.dicks at rawflow.com> writes:

> Hi,
>    I have a simple COM server in python which parses an XML file via 
> SAX, and I want to distribute it via py2exe as the target machines will 
> not have python installed (and in some cases could not have it installed)
>
> However I have tried several (recent) versions of py2exe, python itself 
> and the various fixes suggested by various people in the past, but I 
> still can't get it to work in any configuration using either python 
> 2.3.5/2.4.1 or py2exe 0.4.2/0.5.4 with Windows XP
>
> Using python 2.3 and py2exe 0.4.2, a standalone EXE builds and works 
> fine, but the COM server fails the --register command line with 'Cannot 
> locate Python module win32com.server.localserver' while executing 
> UseCommandLine()
>
> Using python 2.4 and py2exe 0.5.4, the standalone executable fails with:
>
> Traceback (most recent call last):
>    File "fred.py", line 39, in ?
>      parser.parseFile(file(sys.argv[1]))
>    File "xml\sax\drivers\drv_pyexpat.pyc", line 68, in parseFile
>    File "xml\sax\drivers\drv_pyexpat.pyc", line 45, in startElement
>  AttributeError: "module" object has no attribute "AttributeMap"
>
> which no-one else seems to have had trouble with.
>
> Using python 2.3 and py2exe 0.5.4, the py2exe setup stage fails with errors like:
>
> 'Cant find module linecache' 
> 'Cant find module xml'
>
> and the parse stops with 'Cannot find parser' (not surprisingly) if I try to run the resulting executable.
>
> Does anyone know of a combination that works?

Do you have PyXML installed for Python 2.4, and not Python 2.3?  Maybe
this is the reason that the 2.4 build fails - but this is just a guess.

For the 'Cant find module linecache' (speculation again) please take a
look at this page:

http://adelux.c2a.fr/libre/howto/deployTwistedWindows/#bug-in-py2exe-0-5-4

You could try out a similar fix to the boot_com_servers.py script.

Thomas



More information about the Python-win32 mailing list