En Wed, 14 Mar 2007 13:41:17 -0300, Tim Roberts <[EMAIL PROTECTED]> escribió:

>> if __name__ == "__main__":
>>     mp = Dispatch("WMPlayer.OCX")
>>     tune = mp.newMedia('my_file.mp3')
>>     mp.currentPlaylist.appendItem(tune)
>>     mp.controls.play()
>>     raw_input("Press Enter to stop playing")
>>     mp.controls.stop()
>
> My guess is that you aren't in the same directory, so that "my_file.mp3"
> is not found.  Explorer might be setting the starting directory to the
> directory that contains python.exe (since that's what it is really
> executing) instead of the directory with your script.
>
> You might try providing the full path to the file, instead of just a
> relative path.

In addition, you may obtain the directory where your script resides using:

import os
print os.path.dirname(os.path.abspath(__file__))

(I suggest computing that early on your program, because if the current  
directory changes, abspath will give a wrong result)

-- 
Gabriel Genellina

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to