Of course I can
barcode = tracker.get_slot("barcode")
try:
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
db_path = os.path.join(BASE_DIR, "database.sqlite")
sqliteConnection = sqlite3.connect(db_path)
cursor = sqliteConnection.cursor()
# Sqlite query ausfuehren
query = "SELECT product_name FROM selections WHERE code={bc}".format(
bc=barcode
)
cursor.execute(query)
records = cursor.fetchall()
print(records)
...
I tried sqlite3.connect( "database.sqlite")
as well with the same result. My code always enters the catch
block. The error message is no such table
but the table does definitely exist.
Thanks for your help!