Reputation: 511
I have given python script :
import os
os.popen(f'docker run --rm -t --link mosquitto-server ruimarinho/mosquitto mosquitto_pub -h mosquitto-server -t "test_topic" -m "{message}"')
Now, this script works as expected, docker command is executed, but every time i run this line given error appears in terminal:
write /dev/stdout: broken pipe
Can someone please help me get rid of it? I did search for solution but every post is about docker only and no already posted solution works for me.
Upvotes: 0
Views: 2185
Reputation: 169388
Use os.system()
if you're not going to read the pipes opened by os.popen()
. Using os.system()
will not redirect output, though. If you need that, you could try e.g. subprocess.check_output()
(which reads them for you).
Upvotes: 2