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

7th Nov 2019, 4:40 PM
Code Babylon
Code Babylon - avatar
7 Antworten
+ 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.
7th Nov 2019, 4:46 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Code Babylon you forgot a parenthese in line 7, add it at the en
7th Nov 2019, 5:24 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 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.
7th Nov 2019, 5:42 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
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 _
7th Nov 2019, 5:09 PM
Code Babylon
Code Babylon - avatar
0
Aymane Boukrouh [Inactive] Now it's back to "No File or Directory"
7th Nov 2019, 5:27 PM
Code Babylon
Code Babylon - avatar
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
7th Nov 2019, 5:28 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
Aymane Boukrouh [Inactive] Does it help if I say it's an Android operating system?
7th Nov 2019, 5:35 PM
Code Babylon
Code Babylon - avatar