So I made a script that takes data from an MSSQL database and inserts it into a featureclass. I added the script to a toolbox and am able to run the tool from within ArcMap 10.1. The problem is that I cannot re-run the tool. When I try and run it a second time, ArcMap crashes. I'll start ArcMap again, run the tool and when I try and run it the second time ArcMap crashes again.
arcpy.AddMessage() coupled with
time.sleep(5) I have narrowed the problem down to one line of code:
It seems like even though I
del all my pyodbc variables (connection, cursor, row) after I'm done with them the cursor is causing a problem when the script is executed the second time around.
This seems like some kind of bug between ArcMap, arcpy and pyodbc