Subprocess Call works on Windows, but not Ubuntu
Brett Bowman
bnbowman at gmail.com
Tue Nov 23 14:28:56 EST 2010
I ran into an interesting problem trying to spawn a subprocess, so I thought
I'd ask if the experts could explain it to me. I'm spawning a subprocess to
run "pdf2txt.py", which is a tool that is distributed with PDFminer to do
moderately advanced text-dumps of PDFs. Yet when I run the same code on my
two dev machines - one Win XP, the other Ubuntu 10.04 or 10.10 - it only
works on the former and not the later. And its not terribly complicated
code.
# Code Start
sp_line = 'python pdf2txt.py -p 1 -o %s "%s"' % ('temp.out', pdf_filename)
print sp_line
sp = subprocess.Popen(sp_line)
sp.wait()
with open('temp.out', 'r') as pdf_handle:
#Do stuff to read the file
The output from the print statements reads:
python pdf2txt.py -p 1 -o temp.out "Aarts et al (2009).pdf"
That command works on both systems when copied directly to the command-line,
and the python script it is a part of works on the Windows machine, but I
can't the script to work on Ubuntu for the life of me. What am I missing?
/b/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101123/2a49b62d/attachment.html>
More information about the Python-list
mailing list