Now I'm running my scrypt with pythonw.exe and when the following command is executing cmd appears:
r = subprocess.call('net stop tomcat7', shell=False)
print r
How to make cmd not appear when code executing?
Now I'm running my scrypt with pythonw.exe and when the following command is executing cmd appears:
r = subprocess.call('net stop tomcat7', shell=False)
print r
How to make cmd not appear when code executing?
Try to set shell parameter 'True'.
r = subprocess.call('net stop tomcat7', shell=True)
print r
I used this startupinfo with subprocess.Popen (in this project):
subprocess.STARTF_USESHOWWINDOW = 1
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
subprocess.Popen(
[app] + args,
startupinfo=startupinfo,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE)