0

Problem with opening a file from the phone directory

file=open('/storage/sdcard1/Dcoder/classfunc.txt',"r") Traceback (most recent call last): File "source_file.py", line 1, in <module> file=open('/storage/sdcard1/Dcoder/classfunc.txt',"r") FileNotFoundError: [Errno 2] No such file or directory: '/storage/sdcard1/Dcoder/classfunc.txt'

2nd Jul 2017, 7:05 AM
Kreez
Kreez - avatar
9 Respostas
+ 8
well if you're using Sololearn's code playground, it's impossible, as it would only allow you in one folder on their server for one code run. outside of Sololearn, I think you would need a longer more specific path. like c:// if you were on windows, but I'm not sure what the android equivalent is also! put a r behind the path! like this: r"thing/storage/foxpics/ahri.png"
2nd Jul 2017, 7:17 AM
Ahri Fox
Ahri Fox - avatar
+ 6
k well read the outside of Sololearn part. good luck!
2nd Jul 2017, 7:22 AM
Ahri Fox
Ahri Fox - avatar
+ 6
I did. Put on some glasses.
2nd Jul 2017, 7:34 AM
Ahri Fox
Ahri Fox - avatar
+ 6
yes, so follow what I said after: make sure its the full path, and make sure r is before the path string so it interprets it as raw and ignores /'s if that doesn't work then I dunno.
2nd Jul 2017, 7:48 AM
Ahri Fox
Ahri Fox - avatar
+ 1
thank you , fox
2nd Jul 2017, 8:35 AM
Kreez
Kreez - avatar
0
Im using Dcoder
2nd Jul 2017, 7:19 AM
Kreez
Kreez - avatar
0
I understood! I have several compilers on my phone. Some of them use the Internet to execute commands, and some do not. Compilers that do not use the Internet can work with the directory of the phone
2nd Jul 2017, 7:38 AM
Kreez
Kreez - avatar
0
Pyonic can work
2nd Jul 2017, 7:39 AM
Kreez
Kreez - avatar
- 1
but what i have to do you didnt say!
2nd Jul 2017, 7:27 AM
Kreez
Kreez - avatar