Reputation: 4727
I'm trying to write a Python script to convert a bunch of images.
It's something like the following code (after a huge minimization):
#!/usr/bin/python
# -*- coding: utf-8 -*-
from subprocess import call
cmd = ' '.join(['convert.exe', '-resize', '110', 'foo\\a.jpg', 'bar\\a.jpg'])
print cmd
call(cmd)
I get the error below after executing it:
Parameter not valid - 110
While when I copy / paste the string emitted from the script on the command line the image convertion works perfectly. What did I miss?
Upvotes: 2
Views: 266
Reputation:
Windows XP has a command shell command named convert. When I feed it your command, I get the same error message you're seeing. I suspect it is being called instead of your convert.exe.
Upvotes: 0
Reputation: 13508
Are you sure the convert.exe your script is calling is the same one you are calling from the command line. I have, out of bitter experience, always used the full path to the executable I want to call from a script, Python or otherwise.
Upvotes: 0
Reputation:
I would say that the error is most likely the result of two things
shell=True
as the second argument.Upvotes: 1