Problem with os.system()
Oleg Broytmann
phd at phd.pp.ru
Fri Sep 28 10:02:38 EDT 2001
On Fri, Sep 28, 2001 at 03:52:34PM +0200, Janos Blazi wrote:
> 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.
I am not sure, but try to define the "prog" as
prog=r'start "C:\Programme\Windows Media Player\mplayer2"'
or
prog=r'start /w "C:\Programme\Windows Media Player\mplayer2"'
Beware. This probably will return control to your program immediatly,
and this is certainly not what yoy want.
In general, this M$ Ophice GUI (some call it "Windows OS") is not
suitable for this unixish kind of scripting.
Oleg.
----
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list