0

I'm trying to open a windows media file on my desktop although it doesn't seem to open anything at all, what is the issue please?

elif action == "Tutorial":
                os.system("C:\\Program Files (x86)\Windows Media Player\wmplayer.exe" "C:\\Users\Angus\Desktop\Test.mkv"
Angus Ryan
  • 151
  • 2
  • 13

1 Answers1

0

there are so many things wrong here,

  1. you did not provide a MCVE.
  2. You don't show any evidence of checking that the elif branch ever executed in the first place.
  3. You are missing a close ) on os.system(.
  4. You use os.system instead of something in subprocess so you get no error information except the return code which you do not do anything with.
  5. you do not specify a command for os.system like start, just a file which is not valid in bash, just try it in a cmd prompt.
  6. You did not escape the file path so every space makes the program treat it as a seperate argument, you need to add '' quotes around the file name for it to be a valid single path.
  7. You are clearly on windows but not making use of the os.startfile function to do exactly what you are trying to do.
Community
  • 1
  • 1
Tadhg McDonald-Jensen
  • 20,699
  • 5
  • 35
  • 59