Send alt key to subprocess.PIPE stdin

Dave Angel davea at davea.name
Wed Sep 11 16:23:57 EDT 2013


On 11/9/2013 10:26, Wanderer wrote:

> How do I send the command 'Alt+D' to subprocess.PIPE?

That's not a command, it's a keystroke combination.  And without knowing
what RSConfig.exe is looking to get its keystrokes, it might not even be
possible to feed it any keystrokes via the pipe.

if the program does indeed use stdin, there's no portable encoding for
Alt-D.  But if your program only runs on one particular platform, you
might be able to find docs for that platform that explain it.

>
> My code is
>
> import subprocess
> rsconfig = subprocess.Popen(["C:\Program Files\Photometrics\PVCam64\utilities\RSConfig\RSConfig.exe", ],stdin=subprocess.PIPE)

That string will only work by accident.  You need to make it a raw
string, or use forward slashes, or double them.  As it happens, with
this PARTICULAR set of directories, you won't get into trouble with
Python 2.7.3



-- 
DaveA





More information about the Python-list mailing list