[Tutor] [wxPython-users] Executing a python script in WxPython
Alan Gauld
alan.gauld at btinternet.com
Wed Nov 14 06:19:44 CET 2007
"Varsha Purohit" <varsha.purohit at gmail.com> wrote
> I have an application where i need to run a python script from
> wxpython gui. I am calling the script from the button click event.
> And
> the moment button is pressed the python script should be executed.
This comes up from time to time and is usually a bad idea.
Is there a reason why you cannot import the script as a module and
then call a function (or functions) within the script instead of
executing
the script? That is a much safer and more flexible process.
However, if that is impossible you can use subprocess module
to execute any external program including python, so simply call
that fom your event handler.
If you are having difficulties post some sample code and we
can give more specific help.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list