Communicating with the stdin via python subprocess

Viewed 345

I'm running an exe from my python code using subprocess with the following code:

if subprocess.call(string, stderr=stdPoller, stdout=stdPoller, 
       stdin=stdPoller, shell=True)==0:
    return True

stdPoller just polls the stdout and stderr and writes to a log. That's not where the problem is.

When I'm running a certain application I get the following error to the std:

Unhandled Exception: System.InvalidOperationException: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.

and then the process crashes.

I've tried using PIPE for the stdin, calls to communicate etc but can't seem to be able to fix this problem.

0 Answers
Related