Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am a python3 beginner. I am trying to get the java version with a python3 script. After I checked the docs, I saw that subprocess.check_output might be what I need.

output = subprocess.check_output(["java", "-version"])
print("Output is {}".format(output))

The problem is the output I am getting is

Output is b''

Why am I not getting the correct string that I get with bash?

Thanks

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.