Issue running sql command on jupyterlab

I am executing exercise 2 of data analysis with python and its giving me this error
Traceback (most recent call last)
File /lib/python3.11/site-packages/pandas/io/sql.py:2018, in SQLiteDatabase.execute(self, *args, **kwargs)
2017 try:
→ 2018 cur.execute(*args, **kwargs)
2019 return cur

DatabaseError: file is not a database

The above exception was the direct cause of the following exception:

DatabaseError Traceback (most recent call last)
Cell In[7], line 3
1 conn = sqlite3.connect(‘data/sakila.db’)
Can someonr help?

I have executed the same in command prompt. Its readind the db and returning the output . however its not working in jupyterlab

I’m not familiar with the exercise, however at first glance of your post I’m seeing that there is a space between the ‘1’ and ‘conn’ in the ‘1 conn = sql…’ statement and that space is probably considering ‘1’ the command and everything after arguments.

My advice would be remove the space in the variable assignment.

Edit:
Also, now that I’m remembering correctly, variable names in Python can NOT begin with a number. They may have as many numbers you want in the name but not the first character in the variable name. Valid variable names must start with a letter (upper or lowercase) or an underscore (‘_’). If you removed the space and are still getting errors then this might be something to consider.

Good luck, it looks like you are on the right track! :+1: