I use ffmpeg for converting some videos. I am calling command with subprocess.Popen(...)
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
self.my_pro = subprocess.Popen(cmd,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
startupinfo=si)
(output, error) = self.my_pro.communicate()
and i kill with this method
self.my_pro.kill()
It's okey without compile to exe.
But i compiled with pyinstaller
with --noconsole
subprocess not working.
I must change subprocess.Popen(...)
to subprocess.check_output(...)
But this time i can't kill process with self.my_pro.kill()
this not working.
How i can run process with i can kill and it will run pyinstaller noconsole?
As @jfs wrote, with Popen
you have to redirect everything. You forgot stdout
So this code doesn't crash for me anymore:
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
self.my_pro = subprocess.Popen(cmd,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
startupinfo=si)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With