Py2exe embed my modules to libary.zip

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 27 05:44:21 EDT 2008


En Thu, 27 Mar 2008 06:00:26 -0300, <vedrandekovic at gmail.com> escribió:

> I was add this into my application code:
>
> import sys
> import os
> my_dir=os.getcwd()
> sys.path.append(my_dir)
> sys.path.append(my_dir+"\\libary.zip")
> sys.path.append(my_dir+"\\libary.zip\\py2exe") # PY2EXE is folder
> f=open("path.txt","w")
> f.write(str(sys.path))
> f.close()
>
> an the output in path.txt is :
>
> ['C:\\Users\\veki\\Desktop\\python\\PGS\\dist\\library.zip', 'C:\\Users
> \\veki\\Desktop\\python\\PGS\\dist', 'C:\\Users\\veki\\Desktop\\python\
> \PGS\\dist\\libary.zip', 'C:\\Users\\veki\\Desktop\\python\\PGS\\dist\
> \libary.zip\\py2exe']
>
> But it still can't find module py2exe.What should I do now? Any
> examples?

I assume you're talking about the py2exe package available from  
www.py2exe.org - so it's not a module, it's a package.
py2exe usually is only relevant on your *development* machine, so why do  
you want to put it inside a .zip? What do you want to do?

Anyway, I tried the following and could import py2exe successully (but I  
don't know if it actually works as a distutils extension...)

- compressed the py2exe folder into py2exe.zip
- deleted the original py2exe folder
- moved py2exe.zip onto some temporary directory
- tried to import py2exe, failed as expected
- added py2exe.zip to sys.path
- tried to import py2exe, this time OK

py> import py2exe
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ImportError: No module named py2exe
py> import sys
py> sys.path.append(r"C:\TEMP\pna\py2exe.zip")
py> import py2exe
py> py2exe.__path__
['C:\\TEMP\\pna\\py2exe.zip\\py2exe']

-- 
Gabriel Genellina




More information about the Python-list mailing list