subprocess chokes on spaces in path
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Nov 6 15:48:57 EST 2007
En Tue, 06 Nov 2007 17:32:33 -0300, BartlebyScrivener
<bscrivener42 at gmail.com> escribió:
> Using bash on Debian Etch.
>
> If word_doc = sys.argv[1] and it's a file name like My\ Word.doc this
> function reads My and Word as two separate files unless the second
> '%s' is quoted. Took me a lot of trial and error to discover. Is this
> the most elegant way to do it? I was using popen originally, then saw
> some threads suggesting subprocess cured the spaces in path problem.
Use a list of arguments [antiword, word_doc] and let subprocess handle the
spaces the right way.
--
Gabriel Genellina
More information about the Python-list
mailing list