Windows subprocess.call problem
Tim Golden
mail at timgolden.me.uk
Mon Jan 21 06:33:34 EST 2013
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
More information about the Python-list
mailing list