Is it possible to use Sqlite3 on Android using the QPython3 application?

0

I'm trying to create a table:

import sqlite3

def criar_tab_contato(conexao):

   cursor = conexao.cursor()

   sql = """
   CREATE TABLE IF NOT EXISTS contato(
   nome text,
   telefone text,
   senha text
   );
   """

   cursor.execute(sql)


conexao = sqlite3.connect("banco.contato")

criar_tab_contato(conexao)

conexao.close()

But it displays the following error:

 /data/user/0/org.qpython.qpy3/files/bin/qpython-android5.sh "/storage/emulated/0/Download/.last_tmp.py" && exit
lated/0/Download/.last_tmp.py" && exit      <
Traceback (most recent call last):
  File "/storage/emulated/0/Download/.last_tmp.py", line 18, in <module>
    conexao = sqlite3.connect("banco.contato")
sqlite3.OperationalError: unable to open database file
1|whyred:/ $
    
asked by anonymous 25.10.2018 / 18:24

1 answer

0

It is possible from version 1.0 of QPython, however, you need to define where to save the file. The error is indicating that you are not allowed to save in the place where you tried:

conexao = sqlite3.connect("/storage/emulated/0/Download/banco.contato")
    
25.10.2018 / 18:56