Problem with os.system()

Martin Franklin martin.franklin at westgeo.com
Fri Sep 28 10:50:01 EDT 2001


Terry Reedy wrote:

> 
> "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
> 
> 
> 

You could also try winsound (part of the standard lib)

import winsound

fil='c:/WINNT/Media/Microsoft Office 2000/APPLAUSE.WAV'

winsound.PlaySound (file, winsound. SND_FILENAME)





More information about the Python-list mailing list