subprocess call must contain quotations
Verfasst: Freitag 8. Juli 2016, 13:47
Hi,
I need to call a subprocess with quotations (imagemagick, I now there is PythonMagick but I want to use subprocess)
Call on command line is:
convert logo: -fill white -draw "rectangle 50,50 400,400" abc.png
which works perfectly. Remark: The quotations have to be set.
Calling this on python could look like:
which does not word. Reson: rectangle prameter is in bad condition.
I tried several combinations like:
etc.
How can I get the quotations into calling the subprocess?
I need to call a subprocess with quotations (imagemagick, I now there is PythonMagick but I want to use subprocess)
Call on command line is:
convert logo: -fill white -draw "rectangle 50,50 400,400" abc.png
which works perfectly. Remark: The quotations have to be set.
Calling this on python could look like:
Code: Alles auswählen
import subprocess
params = ['convert', 'logo:', '-fill', '-draw', '"rectangle 50,50 400,400"', 'abc.png']
subprocess.check_call(params)
I tried several combinations like:
Code: Alles auswählen
params = ['convert', 'logo:', '-fill', '-draw', '"rectangle', '50,50', '400,400"', 'abc.png']
params = ['convert', 'logo:', '-fill', '-draw', '\"rectangle', '50,50', '400,400\"', 'abc.png']
How can I get the quotations into calling the subprocess?