Oracle & Python trouble

Fred Bartlett vepxistqaosani at netscape.net
Tue Jan 21 17:25:48 CET 2003


Hello!

I'm using Python to access an Oracle DB with the cx_Oracle module.
But Windows 2000 (yeah, yeah, I know ...) doesn't like my script:

<two previous uses of v_Cursor.execute(), which work perfectly>
<dctTableNames is {TABLE1:0,TABLE2:1,...,TABLE5:4}>
<keyTableNames is a list of the keys of dctTableNames>
<lstValues is a list of valued procured previously>
<lstResults is a list of lists>

for value in lstValues:
  for tablename in keyTableNames:
    strSql = "select * from %s where VALUE_ID=%s" % (tablename,value)
    v_Cursor.execute(strSql)
    lstSql = v_Cursor.fetchall()
    if len(lstSql) != 0:
      for i in range(0,len(lstSql)):
        lstResults[dctTableNames[tablename]].append(lstSql[i])

The first time through the "for tablename" loop, it works; the second time,
it crashes with a Win2k error message:

  python.exe - Application Error
  The instructions at <address> referenced memory at "0x00000000". The
  memory could not be "written".

This looks very much like a problem with a rogue null pointer; but where
could it be hiding?

Thanks!

Fred




More information about the Python-list mailing list