Running the following command in linux bash succeeds:
gimp --no-interface -b '(python-fu-scale RUN-NONINTERACTIVE 0 0 "img.jpg")' -b '(gimp-quit 0)'
Output:
batch command executed successfully
is printed and child process exits
Running it with python3.5 fails:
import subprocess
subprocess.run("gimp --no-interface -b '(python-fu-scale RUN-NONINTERACTIVE 0 0 \"img.jpg\")' -b '(gimp-quit 0)'".split())
results in output:
batch command executed successfully
batch command executed successfully
and the child process is stuck.
I'm not sure what's the difference and how to achieve equivalent behaviour in python. Is there a way to run bash command as string?
Using the following source - Calling an external command in Python helped to find an answer
import subprocess
import shlex
subprocess.run(shlex.split("gimp --no-interface -b '(python-fu-scale RUN-NONINTERACTIVE 0 0 \"img.jpg\")' -b '(gimp-quit 0)'"))