By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,996 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,996 IT Pros & Developers. It's quick & easy.

py2exe: zipfile=None raised ImportError

P: n/a
Tim
I'm at the end of my limited experience...

I'm using py2exe to create an executable. I'm using bundle level 1.
When I don't use the zipfile option, the executable and library.zip get
created and the executable works correctly.

When I add the zipfile=None option to put everything into the exe, the
exe doesn't work. It raises an ImportError whose traceback is:

File "...boot_common.py" ... no module name linecache
File "<install zipextimporter... no module named zipextimporter
File "my.py" ... no module name optparse

It looks like the imported modules are not being found in the zip, or
something didn't get included that needed to be included.

Does anybody know what's happening and how to fix it?

Thanks.
--
Tim

Jan 11 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
(I forgot to copy the list ;-)

Tim schrieb:
I'm at the end of my limited experience...

I'm using py2exe to create an executable. I'm using bundle level 1.
When I don't use the zipfile option, the executable and library.zip get
created and the executable works correctly.

When I add the zipfile=None option to put everything into the exe, the
exe doesn't work. It raises an ImportError whose traceback is:

File "...boot_common.py" ... no module name linecache
File "<install zipextimporter... no module named zipextimporter
File "my.py" ... no module name optparse

It looks like the imported modules are not being found in the zip, or
something didn't get included that needed to be included.

Does anybody know what's happening and how to fix it?
I have don't know if this helps or not, but you should better clean everything
(remove the build and the dist subdirectories) when you are changing the options in the
setup script and 'recompile'.

Another tip: You can examine what is in the zipfile, or the exe (if using
zipfile=None) when you rename the file to a *.zip file, and open it with
winzip or another archiver.

Thomas
Jan 11 '07 #2

P: n/a
Tim
Thomas Heller wote:
[..]
Tim schrieb:
[...]
File "...boot_common.py" ... no module name linecache
File "<install zipextimporter... no module named zipextimporter
File "my.py" ... no module name optparse
[...]
Another tip: You can examine what is in the zipfile, or the exe (if using
zipfile=None) when you rename the file to a *.zip file, and open it with
winzip or another archiver.
I clean before every compile.

When I look at the exe as a zip I see all the modules in the error
message: optparse.pyc, zipextimporter.pyc, and linecache.pyc.

I don't see boot_common.py. Why is it being called?

--
Tim

Jan 11 '07 #3

P: n/a
Tim
I see the py2exe mail list posts to this group...

I think I have a handle on the problem: After I build the exe, I rename
it. The renamed exe is the one that raises the error. The original exe
works fine.

--
Tim

Jan 12 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.