Hi,
I want create a subprocess using Popen and pipe some input to it.
Although everything works perfectly while executing python in, it
doesn't work if I try with executables made by py2exe.
I think, stdin is invalidated if the program becomes an executable.
Because I get a "Bad file descriptor" exception in subprogram.py. I
will be more than apreciated, if any suggestions occur.
Thanks,
Mike
== main.py ==
from subprocess import *
pInput = Popen('python subprogram.py', stdin=PIPE, shell=True).std in
# pInput = Popen('subprogr am.exe', stdin=PIPE, shell=True).std in #
doesn't work
pInput.write('D ata')
pInput.close()
== subprogram.py ==
import sys
input = sys.stdin.read( ) # Throws a bad descriptor exception.
print input
I want create a subprocess using Popen and pipe some input to it.
Although everything works perfectly while executing python in, it
doesn't work if I try with executables made by py2exe.
I think, stdin is invalidated if the program becomes an executable.
Because I get a "Bad file descriptor" exception in subprogram.py. I
will be more than apreciated, if any suggestions occur.
Thanks,
Mike
== main.py ==
from subprocess import *
pInput = Popen('python subprogram.py', stdin=PIPE, shell=True).std in
# pInput = Popen('subprogr am.exe', stdin=PIPE, shell=True).std in #
doesn't work
pInput.write('D ata')
pInput.close()
== subprogram.py ==
import sys
input = sys.stdin.read( ) # Throws a bad descriptor exception.
print input
Comment