R
R
r1dddy4sv2021-06-11 14:28:00
Python
r1dddy4sv, 2021-06-11 14:28:00

How to check stdout in subprocess.popen in python?

my code:

result=subprocess.Popen(["do", 'somthing' ],stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    out=result.stdout.read().decode()
    if 'Invalid command line option' in out :
        #do something

If I use print(out), then I see that the line Invalid command line option is there, but in fact the if does not pass.
Tried several ways already, no change.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question