Starting a wxPython application from inside a wxPython application

Anybody knows how to do it? I tried with execfile but it doesn’t work.

If you're using windows you could:

import os
os.startfile("your_python_file.py")

You could also use the subprocess module:

import subprocess
subprocess.call(r"C:\python25\python.exe your_python_file.py")#Wait for
subprocess to terminate

subprocess.Popen(r"C:\python25\python.exe your_python_file.py")#Start
process and continue executing code.

-Kyle Rickey

···

________________________________________
From: wxpython-users-bounces@lists.wxwidgets.org
[mailto:wxpython-users-bounces@lists.wxwidgets.org] On Behalf Of
raffaello
Sent: Wednesday, March 04, 2009 11:34 AM
To: Forum utenti wx.Python
Subject: [wxpython-users] Starting a wxPython application from inside
awxPython application

Anybody knows how to do it? I tried with execfile but it doesn't work.

Many thanks, Kyle, you solved my problem.

···

2009/3/4 Rickey, Kyle W Kyle.Rickey@bakerhughes.com

If you’re using windows you could:

import os

os.startfile(“your_python_file.py”)

You could also use the subprocess module:

import subprocess

subprocess.call(r"C:\python25\python.exe your_python_file.py")#Wait for

subprocess to terminate

subprocess.Popen(r"C:\python25\python.exe your_python_file.py")#Start

process and continue executing code.

-Kyle Rickey


From: wxpython-users-bounces@lists.wxwidgets.org

[mailto:wxpython-users-bounces@lists.wxwidgets.org] On Behalf Of

raffaello

Sent: Wednesday, March 04, 2009 11:34 AM

To: Forum utenti wx.Python

Subject: [wxpython-users] Starting a wxPython application from inside

awxPython application

Anybody knows how to do it? I tried with execfile but it doesn’t work.


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hello,

import subprocess
subprocess.call(r"C:\python25\python.exe your_python_file.py")#Wait for
subprocess to terminate

Note the the current python executable can be found at sys.executable,
so this will become:
subprocess.call([sys.executable, "you_script.py"])

HTH,

···

--
Miki Tebeka <miki.tebeka@gmail.com>

The only difference between children and adults is the price of the toys