I want to spawn a Java process from python script. And then read the stderr stream of the java process from the calling python script. Can this be done using pipes?
I try to spawn the java process from python script using python’s win32 api’s.
I create the java process having the write end of pipe by using the win32process.CreateProcess() method.
Then I wait on the java process to signal (i.e. finish) using win32event.WaitForSingleObject(). Then I try to read through the read end of pipe from the python script using win32file.ReadFile() method.
But I have no idea how to let the java program to communicate with the python script.
Do i need to use signal handler’s in the java code? Kindly give an example…
Thank you,
Parag
You should use
subprocess.Popenfor this, and then call.communicate()to send input, wait for finish, and then get stderr back.The win32 APIs are both overkill and needless complexity for what you’re trying to do.