472,333 Members | 2,307 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

"python exe" and "py plugins"

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
Jul 18 '05 #1
2 3044
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" <ma********@ctrceal.caisse-epargne.fr> a écrit dans le message de
news: bp**********@s1.read.news.oleane.net...
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

Jul 18 '05 #2
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
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sylvain Thenault | last post by:
Hi there ! I'm usually relying on the fact that pyc file are autogenerated when necessary (ie usually when the py file has been modified since...
30
by: bblais | last post by:
Hello, Let me start by saying that I am coming from a background using Matlab (or Octave), and C++. I am going to outline the basic...
2
by: André | last post by:
Short description: Using a wxPython based app, I would like to take a python script in an editor window, invoke the python interpreter and use...
0
by: . | last post by:
http://daviderognoni.blogspot.com?locawapp - MAIN NEWS =========== * add thread * add "Request" object * new "locawapp_main" function *...
0
by: martin.nordstrom87 | last post by:
I'm making a game where you'll be able to make your own mods and I want to be able to write these mods in python. However, python has a lot of...
2
by: bsagert | last post by:
I downloaded Mark Pilgrims's feedparser.py in a zipfile to my Windows machine, unzipped it and tried to install it to no avail. Here is the...
0
by: Alexis Boutillier | last post by:
Hi, I have a strange behaviour of python with pdb and import statement. Here is the example code : file my1.py: import my2 file my2.py:...
0
by: Timothy Grant | last post by:
On Thu, Aug 28, 2008 at 1:40 AM, Alexis Boutillier <alexis.boutillier@arteris.comwrote: So if you were writing C code and the file failed to...
1
by: alexl | last post by:
if my program is an .exe application and I need to reference external assemblies, no problem. I can embed my manifest as resource 1. But if my...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.