windows - Getting python to run an application when the application needs an input file -


import subprocess subprocess.call(['c:\\users\michael\\desktop\\test\\pdftotext']) 

pdftotext application run if use ^ code. works fine, however, i'm trying find way run pdftotext includes pdf's file name pdftotext uses convert text file.

note not question pdftotext.

when use cmd in windows run type pdftotext filename.pdf , converts pdf file text file, no problem. want equivalent python.

i changed this, doesn't work. i'm told "the system cannot find file specified" , i've put pdftotext in src file along filename.pdf

import subprocess subprocess.call(['c:\\users\michael\\desktop\\test\\pdftotext', 'filename.pdf']) 

subprocess.call takes iterable first item executable , following switches , parameters.

this means need change above this:

import subprocess subprocess.call(['c:\\users\michael\\desktop\\test\\pdftotext', 'filename.pdf']) 

Comments