Home > database >  Where to keep files in android such as it'll get called by pyobjects with throwing error that f
Where to keep files in android such as it'll get called by pyobjects with throwing error that f

Time:02-20

I am using chaquopy library to implement few functionalities in android with python. I am having problem with os.getcwd(), whenever i run this it just returns blank. I only gave the Internet permission to my app, but should i have to give storage permission too for this.

I am calling text files from directory which is stored in my python script's directory, because it'll be easy to locate them. still while running app it says file doesn't exists.

Thank you

Edit 1 : i also tried os.listdir() and it return an error 13 saying permission denied '/'

CodePudding user response:

If you look more carefully you'll probably see that os.getcwd is returning "/", i.e. the root directory. This is not writable in a normal app, and may not be readable either on some devices.

For advice on where to keep your data files, see the Chaquopy FAQ sections "Read files in Python" and "Write files in Python".

  • Related