Py2exe embed my modules to libary.zip

Larry Bates larry.bates at websafe.com
Thu Mar 27 13:34:02 EDT 2008


Create your py2exe distribution without a zipfile and all the modules
will just be put into the installation directory.  Use Inno Setup to
make a proper installer for your application.

-Larry

On Thu, 2008-03-27 at 06:44 -0700, vedrandekovic at yahoo.com wrote:
> On 27 ožu, 10:44, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> > En Thu, 27 Mar 2008 06:00:26 -0300, <vedrandeko... 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
> 
> Hello again,
> 
> Thanks for previous post, it was useful!
> 
> So now I know what is a problem, but I don't know how to solve
> it.Under my application user can convert his python code to
> executable,
> I was created this with subprocess:
> 
> retcode =subprocess.Popen(["ython","setup.py","py2exe","-d","exe"],
> shell=True, stdout=subprocess.PIPE,creationflags =
> win32process.CREATE_NO_WINDOW)
> stdout_value = retcode.communicate()[0]
> 
> ...Py2exe exit from process here:
> 
> running py2exe
> creating C:\Users\veki\Desktop\python\PGS\dist\build
> creating C:\Users\veki\Desktop\python\PGS\dist\build\bdist.win32
> creating C:\Users\veki\Desktop\python\PGS\dist\build
> \bdist.win32\winexe
> creating C:\Users\veki\Desktop\python\PGS\dist\build\bdist.win32\winexe
> \collect-2.5
> creating C:\Users\veki\Desktop\python\PGS\dist\build\bdist.win32\winexe
> \bundle-2.5
> creating C:\Users\veki\Desktop\python\PGS\dist\build\bdist.win32\winexe
> \temp
> creating C:\Users\veki\Desktop\python\PGS\dist\exe
> *** searching for required modules ***
> 
> ...it's trying to find d3d,d3dx,d3dc,d3dgui... modules but it can't
> cause these modules are in library.zip.How can I set target for
> finding path to library.zip , I'm running these py2exe compile process
> from my main excutable?
> 
> Regards,
> Vedran




More information about the Python-list mailing list