cx_freeze error

Z

zyqnews

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
 
P

Peter Hansen

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
 
Z

zyqnews

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

Anyone knows how?
 
P

Peter Hansen

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:
(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
 
Z

zyqnews

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.
Is there any hint?
 
P

Peter Hansen

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.

'/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
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top