Skip to content Skip to sidebar Skip to footer

Why Do I Have "'utf-8' Codec Can't Decode Byte 0xc4 In Position 0: Invalid Continuation Byte " Problem And How Do I Solve It?

I am trying to run the simple code, to play the wav sound with playsound (I found this way of sound playing on some website): from playsound import playsound playsound('Piano.wav

Solution 1:

The error you get (275 = MCIERR_FILE_NOT_FOUND) is that the system cannot find the sound file. You need to specify the complete path to the file, not only the file name:

playsound("C:\\Path\\To\\Piano.wav")

If the sound file is in the same directory or a subdirectory of where the script file is placed, see How to properly determine current script directory? for how to get the path to the script file at runtime.

Solution 2:

You usually get this error when an non-UTF-8 character is in your path (like Ü, Ö...). Try to avoid having such characters in the path of your sound file.

Post a Comment for "Why Do I Have "'utf-8' Codec Can't Decode Byte 0xc4 In Position 0: Invalid Continuation Byte " Problem And How Do I Solve It?"