Ah, that fixed it.  Thank you.<br><br><div class="gmail_quote">On Tue, Nov 23, 2010 at 11:37 AM, Chris Rebert <span dir="ltr"><<a href="mailto:clp2@rebertia.com">clp2@rebertia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Nov 23, 2010 at 11:28 AM, Brett Bowman <<a href="mailto:bnbowman@gmail.com">bnbowman@gmail.com</a>> wrote:<br>
> I ran into an interesting problem trying to spawn a subprocess, so I thought<br>
> I'd ask if the experts could explain it to me.  I'm spawning a subprocess to<br>
> run "pdf2txt.py", which is a tool that is distributed with PDFminer to do<br>
> moderately advanced text-dumps of PDFs.  Yet when I run the same code on my<br>
> two dev machines - one Win XP, the other Ubuntu 10.04 or 10.10 - it only<br>
> works on the former and not the later. And its not terribly complicated<br>
> code.<br>
> # Code Start<br>
> sp_line = 'python pdf2txt.py -p 1 -o %s "%s"' % ('temp.out', pdf_filename)<br>
> print sp_line<br>
> sp = subprocess.Popen(sp_line)<br>
</div><snip><br>
<div class="im">> python pdf2txt.py -p 1 -o temp.out "Aarts et al (2009).pdf"<br>
> That command works on both systems when copied directly to the command-line,<br>
> and the python script it is a part of works on the Windows machine, but I<br>
> can't the script to work on Ubuntu for the life of me.  What am I missing?<br>
<br>
</div>Quoting the docs (for the Nth time; emphasis added):<br>
"""<br>
On Unix, with shell=False (default): args should normally be a<br>
sequence. ***If a string is specified for args***, it will be used as<br>
the name or path of the program to execute; ***this will only work if<br>
the program is being given no arguments.***<br>
""" <a href="http://docs.python.org/library/subprocess.html#subprocess.Popen" target="_blank">http://docs.python.org/library/subprocess.html#subprocess.Popen</a><br>
<br>
Fixed version:<br>
sp_args = ['python', 'pdf2txt.py', '-p', '1', '-o', 'temp.out', pdf_filename]<br>
sp = subprocess.Popen(sp_args)<br>
<br>
Cheers,<br>
Chris<br>
<font color="#888888">--<br>
<a href="http://blog.rebertia.com" target="_blank">http://blog.rebertia.com</a><br>
</font></blockquote></div><br>