473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 3128
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 the pyc creation). However, it doesn't seems to...
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 nuts-and-bolts of how I work in these languages, and ask for...
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 another window as stdin/stdout/stderr. Based on...
0
by: . | last post by:
http://daviderognoni.blogspot.com?locawapp - MAIN NEWS =========== * add thread * add "Request" object * new "locawapp_main" function * fixed files.py
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 "dangerous" functions (like erase any file on the...
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 result => C:\>python...
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: a=5
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 compile you would still expect to have a working...
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 program is itself a "plugin," that is a dll that gets...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.