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

Bob Gailer bgailer at alum.rpi.edu
Mon Nov 15 19:57:01 CET 2004


At 06:40 AM 11/15/2004, R. Alan Monroe wrote:

>Here are the relevant parts of the program in question:
>
>----
>locationid = sys.argv[1]
>
>def runupdate(querystring):
>     global mycurs

An aside: global is not needed here. Only needed if you want to re-assign 
to 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
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor

Bob Gailer
bgailer at alum.rpi.edu
303 442 2625 home
720 938 2625 cell 



More information about the Tutor mailing list