473,657 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"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'abl e" ...
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 3137
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()
wxInitAllImageH andlers()
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_INFORMAT ION)
dlg.ShowModal()
dlg.Destroy()

if __name__ == '__main__':
aapp = wxPySimpleApp()
wxInitAllImageH andlers()
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********@ctr ceal.caisse-epargne.fr> a écrit dans le message de
news: bp**********@s1 .read.news.olea ne.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'abl e" ...
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'abl e" ...
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
1416
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 work correctly when the -O option is given to the interpreter : syt@musca:test$ python Python 2.3.4 (#2, Sep 24 2004, 08:39:09) on linux2
30
2893
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 some help to find out how the same thing is done in Python. I am not sure what the standard is. In C++, I open up an editor in one window, a Unix shell in another. I write the code in the editor, then switch to the shell window for compile...
2
3199
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 what I've read so far, I've figured that I need to do something like: f_in, f_out = popen4("python -u script.py") where I have extracted the text from the editor and put it in "script.py". (However, see below).
0
1683
by: . | last post by:
http://daviderognoni.blogspot.com?locawapp - MAIN NEWS =========== * add thread * add "Request" object * new "locawapp_main" function * fixed files.py
0
1010
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 harddrive etc) so I want a "safe" python. I first found RExec but that is disabled in python 2.5 so I was thinking about building python from source with a few changes. The changes I was thinking about was to change the import function so that it...
2
4376
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 c:\scripts\feedparser-4.1\setup.py install running install running build running build_py file feedparser.py (for module feedparser) not found
0
1000
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
1013
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 executable that just worked up until the point of the syntax error? I'm not sure why you just don't fix the syntax error and move on.
1
1151
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 loaded to another .exe program, there's problems. I can still reference the external assembly via resource identifier 2, but if it is a com oriented external assembly I have to either modify the hosting .exe application's resource manifest, use...
0
8413
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.