Forums

Question regarding SQLite

I am very new to pythonanywhere and I'm just looking to get up and running a personal project. I have a sqlite db file, and couple of python files all of which i uploaded in the mysite folder.

Running my app, i can see that the fetch queries (using sqlite3) work fine since the terminal opened below when running the flask app shows the output correctly. But, the website doesn't load and gives "Something went wrong error". In the error logs i get this

Error running WSGI application 2025-01-23 10:46:35,146: sqlite3.OperationalError: no such table: players 2025-01-23 10:46:35,147: File "/var/www/muze3k_pythonanywhere_com_wsgi.py", line 16, in <module> 2025-01-23 10:46:35,147: from flask_app import app as application # noqa 2025-01-23 10:46:35,147: 2025-01-23 10:46:35,147: File "/home/muze3k/mysite/flask_app.py", line 19, in <module> 2025-01-23 10:46:35,147: cursor.execute('SELECT * FROM players')

which indicates that there is no such table named 'players' but in the terminal, using the print statement I get the results just fine, therefore the table does exist and the imports are working fine. I'm a little confused about this and need help.

Is it opening the right db file? Do you use relative or absolute path to it? (use absolute one)

Thanks, it worked. its very odd that relative path showed that database exists with the tables but couldn't fetch tables in the database. But absolute path can fetch.

Thanks for confirming it works (it's hard to comment on the weirdness, since we can't directly reproduce the issue...)