| Store | Cart

How to make an os.system call, without the pop up of the dos-box???

From: Stuart Ford <stu...@forddata.com>
Fri, 4 Aug 2000 13:28:44 -0500
Peter,

Use the os.spawnv(mode, path, args) function.

The spawnv mode parameter sets the execution mode of the called process,
here are the two most common modes:

os.P_WAIT - waits for the called process to complete before resuming
execution of your script.

os.P_DETACH - calls the new process and continues to run your script.

The path parameter is the path to the called process.

The args paramter contains a list or tuple containing the command line
arguments for the called process.


Example:

os.spawnv(os.P_WAIT, 'rmdir', (' ', '/S', '/Q', r'C:\arwa\dev\'))

There is a bug in the 1.5.2 spawnv call!! You need to add a space to
the first argument, or the command line args will not be processed
properly.  I get around this by passing a single space as the first
argument.

I use this workaround method in the above example.


Stuart Ford

---- Original Message -----
From: "Peter Arwanitis" <arwanitis at iabg.de>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Friday, August 04, 2000 11:59 AM
Subject: How to make an os.system call, without the pop up of the dos-box???


> Hi there,>> I try to call some system-calls under a windows-environment, but I'm not> able to make this in "invisible" mode...>> there are calls like:> os.system(r'rmdir /S /Q C:\arwa\dev\') #clear dir-structure recursive>> or>> os.system(r'copy ..\AccessDB_ORIG\OrigPTC.mdb> ..\AccessDB_ORIG\PTC-000526.mdb')>> stuff like that :)>> any hints?>> thanks a lot> (=PA=)>>>> --> http://www.python.org/mailman/listinfo/python-list>

Recent Messages in this Thread
Peter Arwanitis Aug 04, 2000 04:59 pm
wheineman Aug 04, 2000 06:01 pm
Willy Heineman Aug 04, 2000 06:21 pm
Stuart Ford Aug 04, 2000 06:28 pm
Bjorn Pettersen Aug 04, 2000 07:23 pm
spe...@my-deja.com Aug 04, 2000 10:33 pm
Messages in this thread