[python-win32] Issuing a command via subprocess, other methods in Windows 7
smokefloat at gmail.com
Wed Feb 22 08:09:00 CET 2012
Microsoft Windows [Version 6.1.7600](Windows 7)
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on
I've tried numerous methods trying to send a simple command in a shell session.
When the commands are placed into the windows command prompt directly,
they issue perfectly fine, but in the below interpreter session
errors, it finds and utilizes START, as well as other shell commands,
but not for other types of primary commands that work when typed
directly int the windows command prompt, such as SoundRecorder(shown
Below are a few of my unlucky attempts:
>>> scope = subprocess.Popen(["SoundRecorder"],shell = True, stdout=subprocess.P
>>> 'SoundRecorder' is not recognized as an internal or external command,
operable program or batch file.
>>> scope = os.system("START, SoundRecorder")
The system cannot find the file SoundRecorder.
>>> scope = subprocess.Popen([r'START', 'SoundRecorder'],shell = True, stdout=su
>>> The system cannot find the file SoundRecorder.
scope = subprocess.Popen([r'START', 'C:\Windows\System32\SoundRecorder.exe'],she
ll = True, stdout=subprocess.PIPE)
>>> The system cannot find the file C:\Windows\System32\SoundRecorder.exe.
Just using START, like below:
scope = subprocess.Popen([r'START',shell =
initiates the START command, which means it works, but not on command
line when using SoundRecorder which is in the system32 dir. I thought
it might be a directory placement problem, but don't know if that
would be the correct way to fix it, or if that's even the problem.
Any ideas why the above works for the START, and not the
SoundRecorder, when both work on the windows command prompt when typed
More information about the python-win32