ImageMagick Issue
Facundo Batista
facundo at taniquetil.com.ar
Fri Jun 1 09:16:46 EDT 2007
Sick Monkey escribió:
> I ran into another slight problem. And I attempted to fix it, but have
> not been able to do so yet. If a filename does not contain a space,
> then this method works like a charm. But if there is a space then the
> code throws a nasty error.
Ok, the issue is that subprocess.Popen needs a list of the arguments.
So, for simplicity, I made an string and then splitted it:
>>> s = "ls -l /etc"
>>> s.split()
['ls', '-l', '/etc']
>>>
This does not work if you have spaces, even if you escape them:
>>> s = "ls -l '/etc/mi file'"
>>> s.split()
['ls', '-l', "'/etc/mi", "file'"]
>>>
But you can always build the list by hand:
>>> subprocess.Popen(["ls", "-l", "'/etc/mi file'"], ...
Regards,
--
. Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
More information about the Python-list
mailing list