sqlite3 bug?

D

dads

When the method below is run it raises 'sqlite3.OperationalError: no
such table: dave'.
the arguments are ds = a datestamp and w = a string of digits. The
path of the db is
C:\sv_zip_test\2006\2006.db and the table is definitely named dave.
I've run the sql
in sql manager and it works. Is this a bug?


def findArchive(self, ds, w):

year = ds.GetYear()
if year < 2005:
wx.MessageBox('Year out of Archive, check the date!')
return

year = str(year)
archive = 'C:/sv_zip_test'
dbfp = os.path.abspath(os.path.join(archive, year, year +
'.db'))
if os.path.exists(dbfp):
con = sqlite3.connect('dbfp')
cur = con.cursor()
#cur.execute("SELECT * FROM dave WHERE webno = ?", [w])
cur.execute("SELECT * FROM dave")
for r in cur:
self.fil.AppendText(r[2] + '\n')
else:
wx.MessageBox('no db, %s' % dbfp)
 
T

Tim Chase

dads said:
When the method below is run it raises 'sqlite3.OperationalError: no
such table: dave'.
the arguments are ds = a datestamp and w = a string of digits. The
path of the db is
C:\sv_zip_test\2006\2006.db and the table is definitely named dave.
I've run the sql
in sql manager and it works. Is this a bug?

dbfp = os.path.abspath(os.path.join(archive, year, year + '.db'))
if os.path.exists(dbfp):
con = sqlite3.connect('dbfp')

did you mean

connect(dbfp)

instead of

connect('dbfp')

?

-tkc
 
D

dads

Thank you

It just highlights that when your tired things can easily be missed
and
maybe you should leave things until the morning to view things with
fresh eyes =)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,692
Latest member
JenniferTi

Latest Threads

Top