I'm beginner and I just try qpython for android.
I try to connect database at qpython3 by using sqlite3: My code
import sqlite3
conn=sqlite3.connect('mydatabase.db')
But it raises error and unable to open database file.
Any solution for this?? If I try at pc, it automatically create a database if not exists
The reason it doesn't work is that QPython programs are run from '/' directory which of course is not writable to non-root users. You can check this with the following code run from the console.
If you go to the
ftp
utility in the About menu, you will find a directory path that is being used by QPython3. On my HTC mobile it is:So I changed your example code to:
and it works fine for me.
I also found that it is necessary to commit changes or they won't be written to the file. That is, end programs with: