ppp-script

Thomas Wouters thomas at xs4all.nl
Mon Jun 26 04:19:44 EDT 2000


On Mon, 26 Jun 2000 09:52:46 +0200, Philippe Possemiers
<philippe.possemiers at the-ecorp.com> wrote:

>My platform is Linux and I use a modem to dial my ISP. Therefore, I use
>os.exec* in my script to activate /etc/ppp/ppp-on. The question is : how
>do I return to my python script? From the moment I call 'ppp-on', I seem
>to lose all control and cannot return to the python interpreter.

os.exec*() replace the currently executing process, instead of creating a
new process and waiting for it to finish (which is what you want, I
assume.)

You are looking for os.system(). It takes a single string as argument, which
should be the command and any argument, just like you type them on the
shell. (In fact, os.system() just spawns a shell and passes it the string ;)

Alternatively, you can use os.fork() and os.exec*(), and then os.waitpid()
for the child to finish, but that's only necessary if you want to do things
while waiting, or if you want to avoid using the shell (because you want to
fiddle with ARGV, or some such.)

Argh-argv-argc-ly y'rs,
	Thomas.



More information about the Python-list mailing list