[Tutor] Can anybody explain this unusual behavior? Apparent variable corruption?

R. Alan Monroe amonroe at columbus.rr.com
Mon Nov 15 14:40:12 CET 2004


Here are the relevant parts of the program in question:

----
locationid = sys.argv[1]

def runupdate(querystring):
    global mycurs
    log(querystring)
    mycurs.execute(querystring)

if newregion != oldregion or newsite != oldsite or len(changeddepts)>0:
    log("Filling new ztmps over old for this location")
    runupdate("UPDATE mylocation set region=ztmpnewregion,
    site=ztmpnewsite, department=ztmpnewdepartment where
    location_id='%s' and status=0" % (locationid,))
----

My log (per second line of the runupdate function) contains:

Sat Nov 13 08:44:17 2004 UPDATE mylocation set region=ztmpnewregion,
site=ztmpnewsite, department=ztmpnewdepartment where
location_id='000380' and status=0


At no point do I ever re-assign the value of locationid, but somehow I
get this error back, in about 20ish cases out of the 3000 or so times
the script gets executed:


2004/11/13 08:11:21.389 0 4 Executing command line 'python.exe
E:\\updatelocationsProd.py 000380
\"WV\" \"EXAMPLE_CITY\"'...

2004/11/13 08:44:28.857 1 1 (-53) Traceback (most recent call
last):\r\n File
\"E:\\updatelocationsProd.py\",
line 282, in ?\r\n runupdate(\"UPDATE mylocation set
region=ztmpnewregion, site=ztmpnewsite, department=ztmpnewdepartment
where location_id='·L$\x14è°Žúÿ·T$\x18·D$\x1CR·L$\x14P‹F,Q·T$<h' and
status=0\" (locationid,))\r\n File
\"E:\\updatelocationsProd.py\",
line 48, in runupdate\r\n
remcurs.execute(querystring)\r\ndbi.integrity-error:
[Oracle][ODBC][Ora]ORA-00001: unique constraint
(ARADMIN.I476_200000012_1) violated\r\n in EXEC\r\n


Where on earth did "·L$\x14..." come from?

I'm using Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit
(Intel)] on win32

Any ideas?

Alan



More information about the Tutor mailing list