"python exe" and "py plugins"

Discussion in 'Python' started by marco, Nov 18, 2003.

  1. marco

    marco Guest

    Hi,
    first of all ; sorry for my poor english ; i'm french ...
    and i hope you can understand below

    I use python (and wxpython) on a win32 platform, to build a simple "home
    theater pc".
    I want to release it in a package (with all needed to run)
    so i use (the wonderful) py2exe to build it ... it works like a charm ...
    nothing to say

    but, i'd like to make my program "plugin'able" ...
    so i ask myself (and you too ;-), if i could do that :
    - release all "core program" in an exe (with py2exe)
    - release the plugins in ".py" files ... and distribute them in a subfolder
    of my core program.

    and i like to call these "py files" from my core program ... (with
    execfile() ?)
    can the exe call theses, without an "installed python runtime" ? (i hope ;-)

    i hope you understand my need ... and could answer at my question (wish)

    marc
    marco, Nov 18, 2003
    #1
    1. Advertising

  2. marco

    marco Guest

    i answer my self ...

    it WORKS !!!!!!!!!!!!!!!!!!!

    here are a py which i "compiled" into an exe (with py2exe)
    =====================================================
    from wxPython.wx import *

    class Menu(wxFrame):
    def __init__(self, prnt):
    wxFrame.__init__(self,prnt, id=-1,title="jo")
    b=wxButton(self,-1,"coucou")
    EVT_BUTTON(b,-1, self.run)

    def run(self,e):
    execfile("m.py")

    if __name__ == '__main__':
    app = wxPySimpleApp()
    wxInitAllImageHandlers()
    f=Menu(None)
    f.Show()
    app.MainLoop()
    =====================================================

    here is an simple py script which is called by the exe (see up)
    =====================================================
    def msgBox(msg):
    dlg = wxMessageDialog(None, msg, "hell", wxOK | wxICON_INFORMATION)
    dlg.ShowModal()
    dlg.Destroy()

    if __name__ == '__main__':
    aapp = wxPySimpleApp()
    wxInitAllImageHandlers()
    msgBox("coco")
    =====================================================

    and it works WITHOUT THE PYTHON RUNTIME INSTALLED ...
    sure that this script can't import lib which are not in the exe ;-)

    python is a very very great system !!!! i love it a lot !

    "marco" <-epargne.fr> a écrit dans le message de
    news: bpciuh$nhu$...
    > Hi,
    > first of all ; sorry for my poor english ; i'm french ...
    > and i hope you can understand below
    >
    > I use python (and wxpython) on a win32 platform, to build a simple "home
    > theater pc".
    > I want to release it in a package (with all needed to run)
    > so i use (the wonderful) py2exe to build it ... it works like a charm ...
    > nothing to say
    >
    > but, i'd like to make my program "plugin'able" ...
    > so i ask myself (and you too ;-), if i could do that :
    > - release all "core program" in an exe (with py2exe)
    > - release the plugins in ".py" files ... and distribute them in a

    subfolder
    > of my core program.
    >
    > and i like to call these "py files" from my core program ... (with
    > execfile() ?)
    > can the exe call theses, without an "installed python runtime" ? (i hope

    ;-)
    >
    > i hope you understand my need ... and could answer at my question (wish)
    >
    > marc
    >
    >
    marco, Nov 18, 2003
    #2
    1. Advertising

  3. marco

    Miki Tebeka Guest

    Hello Marco,

    > first of all ; sorry for my poor english ; i'm french ...

    Hope my Israeli English will be good enough :)

    > but, i'd like to make my program "plugin'able" ...
    > so i ask myself (and you too ;-), if i could do that :
    > - release all "core program" in an exe (with py2exe)
    > - release the plugins in ".py" files ... and distribute them in a subfolder
    > of my core program.
    >
    > and i like to call these "py files" from my core program ... (with
    > execfile() ?)
    > can the exe call theses, without an "installed python runtime" ? (i hope ;-)

    I don't think there is a problem unless the plugin module uses some
    libraries that py2exe didn't pack. In this case you need to provide
    them as well. You can use distutils or py2exe --dry-run to determine
    which packages are required by the plugin.

    Also be aware of security hazard. If some plugin has
    "sutil.rmtree("c:\\")" somewhere in it you're in big trouble. The
    restricted execution modules in python are currently obsolete.

    HTH.
    Miki
    Miki Tebeka, Nov 18, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc Boeren

    RE: "python exe" and "py plugins"

    Marc Boeren, Nov 18, 2003, in forum: Python
    Replies:
    7
    Views:
    369
    Ahmad Baitalmal
    Nov 20, 2003
  2. Emile van Sebille

    python.exe vs pythonw.exe difference?

    Emile van Sebille, Mar 1, 2004, in forum: Python
    Replies:
    0
    Views:
    1,186
    Emile van Sebille
    Mar 1, 2004
  3. Tim Peters
    Replies:
    0
    Views:
    546
    Tim Peters
    Mar 2, 2004
  4. Chaos
    Replies:
    1
    Views:
    404
  5. whatazor

    pythonw.exe and python.exe

    whatazor, Nov 30, 2007, in forum: Python
    Replies:
    1
    Views:
    573
    Tim Roberts
    Dec 2, 2007
Loading...

Share This Page