FAQ
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

Search Discussions

  • Gerhard Häring at Jan 21, 2003 at 5:30 pm

    Fred Bartlett wrote:
    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:
    [...]
    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?
    Without a C compiler (read: M$VC) and cx_Oracle compiled in debug mode
    (easiest against the debug build of Python; python setup.py build --debug)
    or, alternatively, the temporary addition of a bunch of logging statements
    in the cx_Oracle source you likely won't find out.

    It's IMO very unlikely that this problem is Windows-specific, so if you
    don't have access to the necessary development environment for MS operating
    systems, you could maybe just build DCOracle in debug mode on Linux/Unix
    and do something like:

    #v+
    $ ulimit -c unlimited
    $ python my_script.py
    $ gdb /path/to/python
    gdb> core core
    gdb> bt # <-- this will show the backtrace
    #v-

    nothing-a-few-hundred-printfs-couldn't-fix-ly yours,

    Gerhard
    --
    Gerhard H?ring
    OPUS GmbH M?nchen
    Tel.: +49 89 - 889 49 7 - 32
    http://www.opus-gmbh.net/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJan 21, '03 at 4:25p
activeJan 21, '03 at 5:30p
posts2
users2
websitepython.org

2 users in discussion

Gerhard Häring: 1 post Fred Bartlett: 1 post

People

Translate

site design / logo © 2022 Grokbase