TheShed

Executing a process on Windows

Category: Programming
#Python

A fragment to execute a process on Windows:

from subprocess import Popen
proc = Popen("vi \"" + filename + "\"", shell=True )
print(proc)

Which opens filename with vi (whatever that might be on a Windows box). Note that while Python is pretty good from a crossplatform perspective, it's not the best when it comes to executing other system processes. So, on other platforms, use with care.