[Tutor] Does python change subprocess based on whether it is run in the interactive shell or not
Nathan Smith
nathan-tech at hotmail.com
Fri Oct 28 07:38:59 EDT 2022
Hello,
I have some code like so:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
[stdout, stderr]=p.communicate(data)
Where data is some data taken from io.bytesIO.read
And cmd is a command for ffmpeg like so:
cmd="ffmpeg/ffmpeg.exe -f wav -ac 2 -i - -f mp3 -ab 128000 - -y"
When run in an interactive shell this works like a charm. When run in a
script file, this breaks. At first I thought it was an issue with
FFMPEG, but now I'm wondering if python is changing something under the
hood?
When running from a script, should I be using shell=True?
thanks in advance,
Nathan
--
Best Wishes,
Nathan Smith, BSC
My Website: https://nathantech.net
More information about the Tutor
mailing list