Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > os.system()

Reply
Thread Tools

os.system()

 
 
Yigit Turgut
Guest
Posts: n/a
 
      04-19-2012
When I use os.system() function, script waits for termination of the
windows that is opened by os.system() to continue thus throwing errors
and etc. How can i tell Python to let it go and keep on with the next
execution after os.system() ?
 
Reply With Quote
 
 
 
 
Jacob MacDonald
Guest
Posts: n/a
 
      04-19-2012
On Thursday, April 19, 2012 11:09:22 AM UTC-7, Yigit Turgut wrote:
> When I use os.system() function, script waits for termination of the
> windows that is opened by os.system() to continue thus throwing errors
> and etc. How can i tell Python to let it go and keep on with the next
> execution after os.system() ?


You have to use threads. As in most programming languages (I believe), the program waits for a line to finish before moving on. So you'll have to create a new thread to deal with the windows, then move on to other stuff. Readthe docs on the threading modules.
 
Reply With Quote
 
 
 
 
Steve
Guest
Posts: n/a
 
      04-19-2012
> "Yigit Turgut" wrote in message
> news:b9a8bb28-3003-4a36-86fb-...


> When I use os.system() function, script waits for termination of the

windows that is opened by os.system() to continue thus throwing errors
and etc. How can i tell Python to let it go and keep on with the next
execution after os.system() ?

Can you make use of subprocess.Popen() ?

 
Reply With Quote
 
Yigit Turgut
Guest
Posts: n/a
 
      04-20-2012
On Apr 19, 11:02*pm, "Steve" <n...@spam.com> wrote:
> > "Yigit Turgut" *wrote in message
> >news:b9a8bb28-3003-4a36-86fb-...
> > When I use os.system() function, script waits for termination of the

>
> windows that is opened by os.system() to continue thus throwing errors
> and etc. How can i tell Python to let it go and keep on with the next
> execution after os.system() ?
>
> Can you make use of subprocess.Popen() ?


Still waits for the new windows to kill.
 
Reply With Quote
 
Adam Skutt
Guest
Posts: n/a
 
      04-20-2012
On Apr 20, 6:51 am, Yigit Turgut <y.tur...@gmail.com> wrote:
> On Apr 19, 11:02 pm, "Steve" <n...@spam.com> wrote:
>
> > > "Yigit Turgut" wrote in message
> > >news:b9a8bb28-3003-4a36-86fb-...
> > > When I use os.system() function, script waits for termination of the

>
> > windows that is opened by os.system() to continue thus throwing errors
> > and etc. How can i tell Python to let it go and keep on with the next
> > execution after os.system() ?

>
> > Can you make use of subprocess.Popen() ?

>
> Still waits for the new windows to kill.


It should not do so unless you tell it do so, but without more details
it's difficult to determine what is happening. The only waiting that
should be necessary is to eventually call Popen.poll() or Popen.wait()
to reap the subprocess after it terminates, but there are many correct
ways to do that depending on your application and the subprocess. A
thread, as suggested by Jacob, is one way to accomplish it.

Adam
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments