Execute external command and read stderr/stdout from Jython 2.1
I'm executing an external command from Jython 2.1 by calling os.system()
. This works, but I can't get to any error messages the external program is writing.
Jython 2.1 is开发者_运维技巧 too old to use subprocess
and os.popen
does not seem to exist in Jython 2.1.
How can I capture stderr and stdout of my external program inside my Jython script?
I have never coded in Jython but as far as I know you can use any java class from Jython code. I am sorry if my suggestion is stupid but why not to call java's ProcessBuilder from your Jython script? ProcessBuilder has this functionality.
精彩评论