-1

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

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Lokesh
  • 19
  • 2

1 Answers1

0

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

Faizan
  • 268
  • 2
  • 9