[PYTHON] I got a sqlite3.OperationalError

error contents

sqlite3.OperationalError: no such table: (table name) themes スクリーンショット 2020-05-26 14.27.03.png

File "/Users/mio/shiritori-5-21/app.py", line 92, in remind Open an interactive python shell in this frame

c.execute("select theme from themes where id = ?", (theme_id,))

Check for typographical errors!

First of all, my error was due to a typo.

Table name from the mes not only Database connection db name conn = sqlite3.connect ("service.db ") Let's also check.

I have a table

The themes table has already been created properly in service.db.

No database?

Help !! sqlite3.OperationalError: no such table: users (English) "You may be using a relative path to a database file without worrying about what your working directory is." "It doesn't matter if they are in the same folder. The relative path is the relative path from the working directory, not the referenced file. Even if the database file doesn't exist, sqlite won't complain about the empty database. Offers." I found the answer.

** Empty database !? ** If the database to connect to is not found, it seems to automatically create a database with that name. Don't complain (do not throw an error). It's strange that I can't find it Certainly there is an empty database in Finder or VScode orz

Wrong specification of connection destination database!

conn = sqlite3.connect("service.db")

May be wrong. I have a bad feeling here.

conn = sqlite3.connect("servise.db")

servi s e

Conclusion: just a typo

I'm sorry I misspelled it.

I wanted to leave a note of error resolution! !! !! Be careful because it's common! !! !! !!

Recommended Posts

I got a sqlite3.OperationalError
After installing basemap, I got a numpy import error
I want a mox generator
5 reasons I got into Python
I made a python text
I made a discord bot
I got a Value Error when using JUMAN ++ with PyKNP
i! i! ← This is a mathematical formula
I made a C ++ learning site
I get a UnicodeDecodeError in mecab-python3
Can I be a data scientist?
I touched PyAutoIt for a moment
I got a TypeError:'int' object is not iterable when using keras
I made a Line-bot using Python!
I made a CUI-based translation script (2)
I made a wikipedia gacha bot
I get a KeyError in pyclustering.xmeans
A story that I fixed when I got Lambda logs from Cloudwatch Logs
I have a question about whitespace
I made a fortune with Python.
I got stuck so I reviewed it
I implemented a two-layer neural network
I made a daemon with Python
A reminder of what I got stuck when starting Atcoder with python
I got stuck in a flask application redirect with a reverse proxy in between
A note where a Python beginner got stuck
I made a dash docset for Holoviews
I want to print in a comprehension
I tried to create a linebot (preparation)
What I got into when using Tensorflow-gpu
I made a payroll program in Python!
I touched "Orator" so I made a note
How can I write a good program?
I made a character counter with Python
I tried playing a ○ ✕ game using TensorFlow
I tried drawing a line using turtle
I had turtle draw a trigonometric function
I want to build a Python environment
I have a question! (Python, django) Easy
What I got from Python Boot Camp
I tried a functional language with Python
I made a conversation partner like Siri
What I did with a Python array
I made a script to display emoji
I made a Hex map with Python
I tried to make a Web API
I made a life game with Numpy
I built a TensorFlow environment on windows10
I took a benchmark of h5py compression
I made a stamp generator with GAN
I made a browser automatic stamping tool.
After studying Python3, I made a Slackbot
I tried using pipenv, so a memo
I started Node.js in a virtual environment
I created a password tool in Python.
I implemented NSGA-II, a multi-objective optimization problem.
I made a roguelike game with Python
I tried benchmarking a web application framework
I tried 3D detection of a car
I made a simple blackjack with Python
I made a configuration file with Python