Problem with os.system()

Terry Reedy tjreedy at home.com
Fri Sep 28 16:35:33 CEST 2001


"Janos Blazi" <jblazi at hotmail.com> wrote in message
news:3bb480af_1 at news.newsgroups.com...
> I have the following code:
>
>     prog=r'"C:\Programme\Windows Media Player\mplayer2"'
>     f=r'c:\WINNT\Media\Microsoft Office 2000\APPLAUSE.WAV'
>     os.system(prog+' /Play '+f)
>
> Now first it seems as though it worked and the wav file is played.
The
> problem is that after the wav file has ben played my program does
not regain
> the control i.e. the next statement is not executed. If I close the
Media
> Player window manually, my program resumes. I use Win2000 but my
program
> should work under MS-DOS.

Your 'problem' is not with your Python program, but with mplayer not
closing itself by itself after playing one song.  Perhaps there is a
command line option that would tell it to do so.  Perhaps you should
find a wav-file player that behaves better for your purpose.  I
believe that pygame may give you access to some such.

Terry J. Reedy






More information about the Python-list mailing list