0
No File or Directory in Python
I'm trying to make a program on my phone so I can shuffle my music without having to go into the music app. Anyone see what I'm doing wrong? https://code.sololearn.com/cYYL8DhnKqeT/?ref=app
7 ответов
+ 1
I get different errors when I run your code.
Anyway, since you said the error you got is "No File...", then it's one of two things:
1. SD card/Music will always output error, because there is a blank space there, so it only look for directory named SD, this is how to properly link directories with blani spaces:
os.chdir('"SD card"/Music')
2. The directory really doesn't exist, so you should make sure it is there and has the exact name you used.
+ 1
Code Babylon you forgot a parenthese in line 7, add it at the en
+ 1
Code Babylon , make sure that you python file and SD card folder are in the same directory. Also, make sure you have the necessary permissions to read files. It is not a good idea to practice such things on Android, as you have very limited access to it, and can't run everything on it.
0
Aymane Boukrouh [Inactive] The '"SD card"/Music' works, but now I get "pygame_sdl2.mixer.music.play(0) invalid syntax", with an arrow pointing to the _
0
Aymane Boukrouh [Inactive] Now it's back to "No File or Directory"
0
Then probably the file doesn't exist, I don't know anything about your system, so this is as far as I can go
0
Aymane Boukrouh [Inactive] Does it help if I say it's an Android operating system?