[DB-SIG] Taking exeptions to threads and Access...
kromag@nsacom.net
kromag@nsacom.net
Tue, 12 Jun 2001 12:52:02 -0700 (PDT)
I can't for the life of me figure out what is causing this to barf...
-----------begin script-----------
import win32com.client
import random
import time
import string
import thread
engine=win32com.client.Dispatch("DAO.DBEngine.35")
db=engine.OpenDatabase("\windows\desktop\terror.mdb")
## Function write() writes a list to the database
def write(inputtage):
time=inputtage[0]
data_string=inputtage[1]
db.Execute("insert into data values(%f, '%s')" %(time, data_string))
return 'ok'
if __name__=='__main__':
tik_tok=time.time()
surprize=random.choice(['Hellbilly', 'Crunchy Tack', 'Feeble'])
the_madness=(tik_tok, surprize)
none=0
thread.start_new_thread(write,(the_madness,))
-------------end script------------
It returns:
-----------begin error-------------
Unhandled exception in thread:
Traceback (most recent call last):
File "dbwrite.py", line 14, in write
db.Execute("insert into data values(%f, '%s')" %(time, data_string))
AttributeError: 'None' object has no attribute 'Execute'
>Exit code: 0
----------end error---------------
I am using:
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
on winders 95.
It looks like to me that since I am passing an empty value in:
thread.start_new_thread(write,(the_madness,))
that I somehow need to strip it out somewhere in the function... or not!
Can anyone suggest anything? Thanks!
d