Bug/Patch: Problem with xml/__init__.py when using freeze.py

G

glomde

Hi,

I tried to do freeze.py for my script that uses ElementTree.
But got the this error:

File "/usr/lib/python2.5/xml/__init__.py", line 45, in <module>
_xmlplus.__path__.extend(__path__)
AttributeError: 'str' object has no attribute 'extend'

The reason seems that _xmlplus.__path__ is a string
after freeze.py.

I fixed it by changing the import to:

try:
_xmlplus.__path__.extend(__path__)
sys.modules[__name__] = _xmlplus
except AttributeError:
pass

This might not be the correct solution but it works for me. I do not
really now
how the __path__ variable works in a freezed environment.

Best regards
/T
 
G

Gabriel Genellina

I tried to do freeze.py for my script that uses ElementTree.
But got the this error:

File "/usr/lib/python2.5/xml/__init__.py", line 45, in <module>
_xmlplus.__path__.extend(__path__)
AttributeError: 'str' object has no attribute 'extend'

The reason seems that _xmlplus.__path__ is a string
after freeze.py.

I fixed it by changing the import to:

try:
_xmlplus.__path__.extend(__path__)
sys.modules[__name__] = _xmlplus
except AttributeError:
pass

This might not be the correct solution but it works for me. I do not
really now
how the __path__ variable works in a freezed environment.

The extend_path function (found in the pkgutil standard module) can handle
this.
http://docs.python.org/lib/module-pkgutil.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top