Py2exe embed my modules to libary.zip

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vedrandekovic@gmail.com

    Py2exe embed my modules to libary.zip

    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.Fram e(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.zi p/d3dx.py".
    I'm not sure is this properly set question.

    Regards,
    Vedran
  • Gabriel Genellina

    #2
    Re: Py2exe embed my modules to libary.zip

    En Wed, 26 Mar 2008 14:55:43 -0300, <vedrandekovic@ gmail.comescrib ió:
    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.Fram e(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.zi p/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

    Comment

    • Tzury Bar Yochay

      #3
      Re: Py2exe embed my modules to libary.zip

      ....and then when my application execute code how can I set path to
      d3dx module to "library.zi p/d3dx.py".
      I'm not sure is this properly set question.
      use the module zipimport
      Source code: Lib/zipimport.py This module adds the ability to import Python modules (*.py,*.pyc) and packages from ZIP-format archives. It is usually not needed to use the zipimport module explicit...

      Comment

      • Gabriel Genellina

        #4
        Re: Py2exe embed my modules to libary.zip

        En Wed, 26 Mar 2008 15:38:16 -0300, Tzury Bar Yochay
        <Afro.Systems@g mail.comescribi ó:
        >....and then when my application execute code how can I set path to
        >d3dx module to "library.zi p/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

        Comment

        • vedrandekovic@gmail.com

          #5
          Re: Py2exe embed my modules to libary.zip

          On 26 ožu, 20:11, "Gabriel Genellina" <gagsl-...@yahoo.com.a rwrote:
          En Wed, 26 Mar 2008 15:38:16 -0300, Tzury Bar Yochay
          <Afro.Syst...@g mail.comescribi ó:
          >
          ....and then when my application execute code how can I set path to
          d3dx module to "library.zi p/d3dx.py".
          I'm not sure is this properly set question.
          >>
          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.getcw d()
          sys.path.append (my_dir)
          sys.path.append (my_dir+"\\liba ry.zip")
          sys.path.append (my_dir+"\\liba ry.zip\\py2exe" ) # PY2EXE is folder
          f=open("path.tx t","w")
          f.write(str(sys .path))
          f.close()

          an the output in path.txt is :

          ['C:\\Users\\vek i\\Desktop\\pyt hon\\PGS\\dist\ \library.zip', 'C:\\Users
          \\veki\\Desktop \\python\\PGS\\ dist', 'C:\\Users\\vek i\\Desktop\\pyt hon\
          \PGS\\dist\\lib ary.zip', 'C:\\Users\\vek i\\Desktop\\pyt hon\\PGS\\dist\
          \libary.zip\\py 2exe']

          But it still can't find module py2exe.What should I do now? Any
          examples?

          Regards,
          Vedran

          Comment

          Working...