[wingide-users] Using subprocess in scripts
fuzzyman at voidspace.org.uk
Sat Dec 30 17:41:17 MST 2006
Michael Foord wrote:
> Hello all,
> I'm experimenting with writing scripts.
> The problem with using 'os.system' to launch scripts is that it is
> synchronous - WingIDE is blocked until the script returns.
> I would like to use 'subprocess' to launch commands. The 'subprocess'
> module isn't included in the Wing 'Python24.zip', so I can't use it. Any
> reason why it isn't available ?
FWIW this is my solution :
from threading import Thread
editor = app.GetActiveEditor()
filename = editor.GetDocument().GetFilename()
directory, theFile = os.path.split(filename)
if os.path.split(directory) == 'UnitTests':
directory = os.path.split(directory)
thread = Thread(target=lambda: os.system('run_python "%s"' % filename))
> All the best,
> Michael Foord
> Wing IDE users list
More information about the wingide-users