Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Windows subprocess.call problem (http://www.velocityreviews.com/forums/t956752-re-windows-subprocess-call-problem.html)

Tim Golden 01-21-2013 11:33 AM

Re: Windows subprocess.call problem
 
On 21/01/2013 11:25, Tom Borkin wrote:
> Hi;
> I have this code:
>
> #!/Python27/python
> import os, subprocess, sys
> lyrics_path = "/Users/Tom/Documents/lyrics"
> os.chdir(lyrics_path)
>
> songs = ['livin-la-vida-loca', 'whos-that-lady']
> for song in songs:
> subprocess.call(['notepad.exe', '%s.txt' % song])
> my_songs_path = "aa english lyrics"
> os.chdir(my_songs_path)
> for song in my_songs:
> subprocess.call(['notepad.exe', '%s.txt' % song])
> print song
>
> It opens the first song and hangs on subsequent songs. It doesn't open
> the next song or execute the print until I have closed the first one. I
> want it to open all in the list, one after another, so I have all those
> songs available. Please advise.


subprocess.call is a convenience for starting a process and waiting for
it to finish. If you want to start a process and carry on, use
subprocess.Popen directly (same params)

TJG


All times are GMT. The time now is 11:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.