Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3.2 SQLite 3 Error with connect function

Tags:

python

sqlite

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,

like image 995
abuteau Avatar asked Apr 27 '26 13:04

abuteau


1 Answers

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

like image 198
falsetru Avatar answered Apr 29 '26 04:04

falsetru



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!