On Wed, Feb 22, 2012 at 12:59 PM, Tim Roberts <t...@probo.com> wrote: > David Hutto wrote: >> 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 >> directly in? > > Yes. The one critical piece of information you did not supply here is > that you are running 64-bit Windows 7. That's the root of the problem. > > SoundRecorder.exe is a 64-bit executable, and lives in > \Windows\System32. When you are a 32-bit process on 64-bit Windows, and > you try to refer to files in \Windows\System32, the operating system > "helpfully" rewrites the path so you actually refer to > \Windows\SysWOW64, which is where the 32-bit executables and DLLs live. > > Unlike almost every other utility, there is no 32-bit version of > SoundRecorder.exe, so subprocess fails to find the executable and dies. > Cmd.exe is a 64-bit process, so it looks in the real System32 and finds it. > > So, what are your options? One answer is to install a 64-bit build of > Python. Another answer is to turn off the file system redirection using > ctypes.windll.kernel32.Wow64DisableWow64FsRedirection (I just tried it > -- it works). > > By the way, there is no point in using Popen with SoundRecorder. It's a > GUI application. It doesn't use stdin and stdout. In the command line using switches it does. I just need it to record a .wav file for a specific duration like below:
subprocess.Popen(['SoundRecorder','/FILE',r'c:\Users\david\test01.wav','/DURATION','0000:00:02'],shell = True) The first suggestion, to disable using the 32 bit version, still left me with a 'SoundRecorder not found pop-up window'. I tried the 2.7 64 bit and it works wonderfully now. Thanks for your help, David > -- > Tim Roberts, t...@probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32