os.open is not working whie I am trying to play music

114 views Asked by At

While I am trying to open music from python using speech it was not working properly.
enter image description here The images of code and the error I am facing was attached

    elif 'play music' in query:
    music_dir='/home/lokesh/Music/fav'
    songs=os.listdir(music_dir)
    os.open(os.path.join(music_dir,songs[0]))
  • List item

help me to correct this

1

There are 1 answers

0
Faizan On

The exception is raised by os.open. os.open method also requires falgs which tells the method in which mode to open the file, for example, in read mode, write mode, etc. You can read about different flags here: https://docs.python.org/3/library/os.html#os.O_RDONLY