G
Greg Corradini
Hello all,
In a script i just wrote, my code calls a function createTables(), which
checks for an existing table and then creates it, and then immediately calls
selectSQL(), which selects from a different table and inserts on the table I
just created (see below).
However, I continue to get an Interface Error (see below) when i run it. And
yet, if I allow the code to call createTables() and then manually call
selectSQL() after a couple seconds, the thing works fine. In short, there's
no mismatch in the number of parameters. Why would this be? I've never
experienced this before. How can i restructure my code to resolve this
problem?
---
CODE
---
def createTables():
# Drop AddScript Table
try:
curse.execute('Drop table ' +countyname+'ADD_SCRIPT_TABLE')
conn.commit
except:
pass
# Create AddScript Table
curse.execute('Create table ' +countyname+'ADD_SCRIPT_TABLE'+ ' (TISCODE
TEXT(12), STATUS TEXT(4))')
conn.commit()
def selectSQL():
sql = "Select TISCODE,STATUS from " +countyname+"0"+ " where STATUS =
'AS'"
curse.execute(sql)
a = curse.fetchall()
curse.executemany('Insert into ' +countyname+'ADD_SCRIPT_TABLE'+ '
(TISCODE,STATUS) values (?,?)',x)
conn.commit()
In a script i just wrote, my code calls a function createTables(), which
checks for an existing table and then creates it, and then immediately calls
selectSQL(), which selects from a different table and inserts on the table I
just created (see below).
However, I continue to get an Interface Error (see below) when i run it. And
yet, if I allow the code to call createTables() and then manually call
selectSQL() after a couple seconds, the thing works fine. In short, there's
no mismatch in the number of parameters. Why would this be? I've never
experienced this before. How can i restructure my code to resolve this
problem?
---
CODE
---
def createTables():
# Drop AddScript Table
try:
curse.execute('Drop table ' +countyname+'ADD_SCRIPT_TABLE')
conn.commit
except:
pass
# Create AddScript Table
curse.execute('Create table ' +countyname+'ADD_SCRIPT_TABLE'+ ' (TISCODE
TEXT(12), STATUS TEXT(4))')
conn.commit()
def selectSQL():
sql = "Select TISCODE,STATUS from " +countyname+"0"+ " where STATUS =
'AS'"
curse.execute(sql)
a = curse.fetchall()
curse.executemany('Insert into ' +countyname+'ADD_SCRIPT_TABLE'+ '
(TISCODE,STATUS) values (?,?)',x)
conn.commit()