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 embed my modules to libary.zip

P: n/a
Hello,

Does anybody have any idea how can I embed my modules to libary.zip
and use it from my application.For example if user write this code in
my TextEntry ( or something like that, textentry is created with
wxpython ) :

import d3dx # directpython module
frame=d3dx.Frame(u"My frame") # create frame
frame.Mainloop() # run it

.....and then when my application execute code how can I set path to
d3dx module to "library.zip/d3dx.py".
I'm not sure is this properly set question.

Regards,
Vedran
Mar 26 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
En Wed, 26 Mar 2008 14:55:43 -0300, <ve***********@gmail.comescribió:
Does anybody have any idea how can I embed my modules to libary.zip
and use it from my application.For example if user write this code in
my TextEntry ( or something like that, textentry is created with
wxpython ) :

import d3dx # directpython module
frame=d3dx.Frame(u"My frame") # create frame
frame.Mainloop() # run it

....and then when my application execute code how can I set path to
d3dx module to "library.zip/d3dx.py".
I'm not sure is this properly set question.
If d3dx.py is in library.zip (top level), and the path to library.zip is
in sys.path, Python will find the module.
A .zip in sys.path acts as it were a directory itself.

--
Gabriel Genellina

Mar 26 '08 #2

P: n/a
....and then when my application execute code how can I set path to
d3dx module to "library.zip/d3dx.py".
I'm not sure is this properly set question.
use the module zipimport
http://docs.python.org/lib/module-zipimport.html
Mar 26 '08 #3

P: n/a
En Wed, 26 Mar 2008 15:38:16 -0300, Tzury Bar Yochay
<Af**********@gmail.comescribió:
>....and then when my application execute code how can I set path to
d3dx module to "library.zip/d3dx.py".
I'm not sure is this properly set question.

use the module zipimport
http://docs.python.org/lib/module-zipimport.html
You don't have to do anything special to "use" zipimport; from
<http://docs.python.org/lib/module-zipimport.html:
"It is usually not needed to use the zipimport module explicitly; it is
automatically used by the builtin import mechanism"

--
Gabriel Genellina

Mar 26 '08 #4

P: n/a
On 26 ožu, 20:11, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:
En Wed, 26 Mar 2008 15:38:16 -0300, Tzury Bar Yochay
<Afro.Syst...@gmail.comescribió:
....and then when my application execute code how can I set path to
d3dx module to "library.zip/d3dx.py".
I'm not sure is this properly set question.
use the module zipimport
http://docs.python.org/lib/module-zipimport.html

You don't have to do anything special to "use" zipimport; from
<http://docs.python.org/lib/module-zipimport.html:
"It is usually not needed to use the zipimport module explicitly; it is
automatically used by the builtin import mechanism"

--
Gabriel Genellina
Hello,

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\\libr ary.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?

Regards,
Vedran

Mar 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.