2 things come to mind. First, I always use a list in the insert, not a tuple as you have.Second, the insert is happening inside a function where the variables have not been defined. Python always surprises me with how it knows about global variables even if they're not declared but that could still be your problem.

rrashkin wrote:2 things come to mind. First, I always use a list in the insert, not a tuple as you have.Second, the insert is happening inside a function where the variables have not been defined. Python always surprises me with how it knows about global variables even if they're not declared but that could still be your problem.

So you think i can't access those variables outside of the function?

I guess i could put all of the code into the function and just call it.