It's probably something quite easy but I can't figure out why my script won't work. I'm trying to make a connection with my sqlite3 database but eclipse returns the error: "Undefined variable from import: connect". I'm running python 3.3 in a virtualenv on linux. Thanks for your help!
from urllib.request import urlopen
import datetime
import sqlite3
class Crawler():
def storeContent(self, html, url):
conn = sqlite3.connect('database.db')
c = conn.cursor()
c.execute("INSERT .. ", [item, item])
c.commit()
c.close()
connectis one of the functions that gets imported from_sqlite3and re-exported fromsqlite3. So, the first thing I'd try is:import _sqlite3. If that works, callhelp(_sqlite3)ordir(_sqlite3)and see if they look right._sqlite3, with the underscore, is a C extension module.sqlite3, without the underscore, is a pure-Python module that wraps up that extension module. Please try the tests I suggested on the one with the underscore. For testing other C extension modules… in 3.3, most of these are wrapped up the same way assqlite3, but there are a few that haven't been. I believeimport audioop; print audioop.__file__should show a .so/.dll/.pyd file, not a .py file.