cx_freeze error

Discussion in 'Python' started by zyqnews@163.net, Jan 30, 2005.

  1. Guest

    I am new to Python. I made a script, and compiled it with cx_freeze,
    but I got the following message from it:

    [cxfreeze]$./FreezePython hello.py
    Traceback (most recent call last):
    File "initscripts/ConsoleKeepPath.py", line 15, in ?
    exec code in m.__dict__
    File "FreezePython.py", line 1, in ?
    File "optparse.py", line 72, in ?
    File "textwrap.py", line 32, in ?
    File "textwrap.py", line 81, in TextWrapper
    AttributeError: 'module' object has no attribute 'compile'
    Does anyone know what I should do ?

    Thanks
    , Jan 30, 2005
    #1
    1. Advertising

  2. Peter Hansen Guest

    wrote:
    > I am new to Python. I made a script, and compiled it with cx_freeze,
    > but I got the following message from it:
    >
    > [cxfreeze]$./FreezePython hello.py
    > Traceback (most recent call last):
    > File "initscripts/ConsoleKeepPath.py", line 15, in ?
    > exec code in m.__dict__
    > File "FreezePython.py", line 1, in ?
    > File "optparse.py", line 72, in ?
    > File "textwrap.py", line 32, in ?
    > File "textwrap.py", line 81, in TextWrapper
    > AttributeError: 'module' object has no attribute 'compile'
    > Does anyone know what I should do ?


    Possibly do not use the name "re.py" for your own module, as it
    is the name of a standard library module as well.

    At least, that's what an analysis of line 81 of "textwrap.py"
    suggests might be your problem. Do you have a module named
    "re.py"?

    -Peter
    Peter Hansen, Jan 30, 2005
    #2
    1. Advertising

  3. Guest

    There is no any module like "re.py", I just compiled the hello.py it
    has only one line:
    print "hello!"

    Anyone knows how?
    , Jan 30, 2005
    #3
  4. Peter Hansen Guest

    wrote:
    > There is no any module like "re.py", I just compiled the hello.py it
    > has only one line:
    > print "hello!"


    Interesting. Just to confirm, could you try this? Run
    Python, and at the interactive prompt, type the following:

    >>> import re
    >>> re.compile

    <function compile ....>
    >>> re.__file__

    (path to file re.pyc)

    If you get an AttributeError after the second line, then
    the result of the third line (re.__file__) will tell you
    where this "re" module is that doesn't have a compile()
    function like it should have.

    Either there's an "re" kicking around that shouldn't be
    there, or cx_freeze is doing something weird... at least,
    those are the only theories that come to mind.

    -Peter
    Peter Hansen, Jan 30, 2005
    #4
  5. Guest

    Thanks for your answer.
    I tried it and the result is:
    [cxfreeze]$ python
    Python 2.2.3 (#1, Oct 15 2003, 23:33:35)
    [GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import re
    >>> re.compile

    <function compile at 0x81a244c>
    >>> re.__file__

    '/usr/lib/python2.2/re.pyc'
    >>>


    Is there any hint?
    , Jan 30, 2005
    #5
  6. Peter Hansen Guest

    wrote:
    > Thanks for your answer.
    > I tried it and the result is:
    > [cxfreeze]$ python
    > Python 2.2.3 (#1, Oct 15 2003, 23:33:35)
    > [GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2
    > Type "help", "copyright", "credits" or "license" for more information.
    >
    >>>>import re
    >>>>re.compile

    >
    > <function compile at 0x81a244c>
    >
    >>>>re.__file__

    >
    > '/usr/lib/python2.2/re.pyc'
    >
    > Is there any hint?


    "Hint", maybe. Clear answer, not for me.

    What it means is that your re module definitely has a "compile"
    function, as it is supposed to. What that suggests is that when
    the textwrap.py module is being imported by cx_freeze, it is
    not finding the correct "re" module when it imports it.
    I don't know anything about cx_freeze, and I don't have
    an appropriately configured Linux box to help troubleshoot,
    so I can't help further, but maybe somebody else could
    try compiling a simple "hello.py" like you did and offer
    some suggestions.

    -Peter
    Peter Hansen, Jan 30, 2005
    #6
    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. Simon John
    Replies:
    2
    Views:
    685
    Simon John
    Sep 19, 2004
  2. Thomas W
    Replies:
    1
    Views:
    1,615
    Thomas W
    Jun 9, 2005
  3. Ivan Shevanski
    Replies:
    0
    Views:
    541
    Ivan Shevanski
    Jun 9, 2005
  4. 1stpoint
    Replies:
    0
    Views:
    286
    1stpoint
    Mar 3, 2006
  5. james27

    cx_freeze install_exe error

    james27, Oct 16, 2009, in forum: Python
    Replies:
    0
    Views:
    656
    james27
    Oct 16, 2009
Loading...

Share This Page