I have a directory (/home/usuario/Desktop/Example) with one database (MyBBDD.db) and the file (script.py) that run the command "UPDATE". If in the terminal I'm in the directory "Example", script.py work fine but if Im not in the directory "Example" and I execute script.py like this: " python /home/usuario/Desktop/Example/script.py
" doesnt work fine, the error is: "no such table: name_table". Somebody know what is the problem? Thanks in advance.
Best regards.
code as of comments script.py
import urllib
import sqlite3
conn = sqlite3.connect('MyBBDD.db')
c = conn.cursor()
c.execute ("UPDATE...")
conn.commit()
c.close()
conn.close()
在script.py中使用sqlite3
创建连接对象时,请使用绝对文件路径,即
con = sqlite3.connect('/home/usuario/Desktop/Example/MyBBDD.db')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.