I have a python script that includes several subprocess.call commands. I wrote a script on Mac and it works fine. I just tried to run it on Windows and I am confused by the error.
The following command to call ImageMagick returns "exit status 4":
file1 = "D:/Temp/OCR_test/sample/images/crops/time_0011.png" subprocess.call(['convert', file1, '-resize', '200%', file1])
Changing a team to the following actions:
subprocess.call(['convert', file1, '-resize', '200%', file1], shell=True)
I am a little afraid to use shell=True due to warnings in the documentation.
I also need a command to work on both Mac and Windows, and I'm confused about why it won't work on Windows (I checked and the command works with Windows CMD).
Interestingly, the following line previously worked in a script (where file , lat_crop1 and croplat are defined variables):
subprocess.call(['ffmpeg', '-loglevel', 'panic', '-i', file, '-vf', lat_crop1, '-n', croplat])
I read this SO question and tried all the suggestions (shlex, my team options, etc.), but I still get the same result.
Does anyone know how I can change this line so that it can work without shell=True ?
Also, what does โexit status 4โ mean? I figured out and read so much documentation, but found nothing about it.
EDIT: Based on the information provided in the answer, I changed a command that did not work on subprocess.call(['mogrify', file1, '-resize', '200%', file1]) and runs successfully in Python on Windows. Fortunately, ImageMagick provides mogrify as an alternative to convert .