Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > cx_freeze error

Reply
Thread Tools

cx_freeze error

 
 
zyqnews@163.net
Guest
Posts: n/a
 
      01-30-2005
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

 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      01-30-2005
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
 
Reply With Quote
 
 
 
 
zyqnews@163.net
Guest
Posts: n/a
 
      01-30-2005
There is no any module like "re.py", I just compiled the hello.py it
has only one line:
print "hello!"

Anyone knows how?

 
Reply With Quote
 
Peter Hansen
Guest
Posts: n/a
 
      01-30-2005
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

 
Reply With Quote
 
zyqnews@163.net
Guest
Posts: n/a
 
      01-30-2005
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?

 
Reply With Quote
 
Peter Hansen
Guest
Posts: n/a
 
      01-30-2005
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cx_freeze install_exe error james27 Python 0 10-16-2009 07:01 PM
cx_Freeze 3.0.2 and Linux sax problem. 1stpoint Python 0 03-03-2006 04:09 PM
cx_freeze error : LookupError: no codec search functions registered: can't find encoding Thomas W Python 1 06-09-2005 10:02 PM
RE: cx_freeze error : LookupError: no codec search functions Ivan Shevanski Python 0 06-09-2005 05:22 PM
$LD_LIBRARY_PATH, cx_Freeze and wxPython Simon John Python 2 09-19-2004 07:31 AM



Advertisments