3

I try to learn SQL and I do that with Python 3.2. I know that SQLite3 module is installed with Python, but when I try to do this code:

import sqlite3
conn = sqlite3.connect('example.db')

I got this error: Undefined variable from import: connect

I have checked In usr/lib and the .so file is there..

What can I do to solve that ?

Regards,

1 Answer 1

4

I think you're using pydev.

Try it in non-pydev environ.

>>> import sqlite3
>>> conn = sqlite3.connect('example.db')

UPDATE: The actual fix for this problem is given in the following link

Sign up to request clarification or add additional context in comments.

7 Comments

@abuteau, Did you build python yourself?
No..Installing via apt-get on linux with sudo apt-get install python3-all
@abuteau, What is the result of ls /usr/lib/python3.2/lib-dynload/*sqlite*so?
/usr/lib/python3.2/lib-dynload/_sqlite3.cpython-32mu.so
@abuteau, This link may help you.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.