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

Discussion in 'Python' started by glomde, Jan 31, 2008.

  1. glomde

    glomde Guest

    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
     
    glomde, Jan 31, 2008
    #1
    1. Advertising

  2. En Thu, 31 Jan 2008 13:16:47 -0200, glomde <> escribió:

    > 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

    --
    Gabriel Genellina
     
    Gabriel Genellina, Feb 1, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven Bethard
    Replies:
    2
    Views:
    470
    Steven Bethard
    Feb 16, 2005
  2. Kent Johnson
    Replies:
    7
    Views:
    931
    Jan Niklas Fingerle
    Feb 12, 2006
  3. George Sakkis
    Replies:
    3
    Views:
    389
  4. Replies:
    5
    Views:
    270
    Olivier Renaud
    Mar 15, 2007
  5. Ramchandra Apte
    Replies:
    17
    Views:
    353
    Manuel Pégourié-Gonnard
    Sep 30, 2012
Loading...

Share This Page