[python-win32] Please help, run into a COM object issue using the windows media SDK, thanks!

jjpet jjpet1 at yahoo.com
Fri Oct 10 02:44:27 CEST 2008


Hello all,

I am trying to create an app. that talks to the Microsoft COM object called "wmplayer.ocx", which comes with the windows media SDK. Everything seems to be working fine...... except that it only works when I run it within PythonWin :)

What happened when I drove the script from the command line was the player object I created seems to get returned fine, and could be accessed for setting configuration parameters, etc, but it was NOT able to play the audio clip. All I am saying is when running it outside of PythonWin, it only works to some extent......

here is the script:
___________________________________________________________________
import win32com.client

class MyEvent:
    def OnPlayStateChange(self, state):
        print state
                
mp = win32com.client.DispatchWithEvents('wmplayer.ocx',  MyEvent)

mp.URL = u'rtsp://rtsp_server_addr/audio_file_name.wmv'

mp.controls.play() 
___________________________________________________________________

Within PythonWin, the sequence of states get printed indicates the clip was played to completion successfully. When running it from the command line, it never gets into the play state... I am developing it on winXP.

Has anybody run into similiar problems before? Working with a COM object that only works properly within PythonWin? Any way to run the script from the command line or any other method without relying on the PythonWin GUI while having the same effect as running it within PythonWin? 

I was wondering if PythonWin had some binaries that could run a script without launching the GUI editor, but couldn't find any...

Any help on this is greatly appreciated, thanks!

--Yufeng



      



More information about the python-win32 mailing list