Multithreaded python script calls the COMMAND LINE

gagsl-py at yahoo.com.ar gagsl-py at yahoo.com.ar
Thu Dec 7 16:05:26 EST 2006


On 7 dic, 17:36, "johnny" <rampet... at gmail.com> wrote:
> I have python script does ftp download in a multi threaded way. Each
> thread downloads a file, close the file, calls the comman line to
> convert the .doc to pdf. Command line should go ahead and convert the
> file. My question is, when each thread calls the command line, does one
> command line process all the request, or each thread creates a one
> command line process for themselves and executes the command? For some
> reason I am getting "File '1' is alread exists, Do you want to
> overwrite [y/n]?" I have to manually enter 'y' or 'n' for the python
> script to complete.

That depends on how you invoke it: os.system creates a new shell which
in turn creates a new process; the spawn* functions do that directly.
Anyway, if you have many conversion processes running, you should pass
them unique file names to avoid conflicts.
Where does the '1' name come from? If it's you, don't use a fixed name
- the tempfile module may be useful.




More information about the Python-list mailing list