cx_Oracle question

Richard Schulman raschulmanxx at
Fri Sep 8 20:26:42 CEST 2006

I'm having trouble getting started using Python's cx_Oracle binding to
Oracle XE. In forthcoming programs, I need to set variables within sql
statements based on values read in from flat files. But I don't seem
to be able to get even the following stripped-down test program to

import cx_Oracle
connection = cx_Oracle.connect("username", "password")
cursor = connection.cursor()

arg_1 = 2 #later, arg_1, arg_2, etc. will be read in files

cursor.execute("""select mean_eng_txt from mean
                  where mean_id=:arg_1""",arg_1)
for row in cursor.fetchone():
    print row

The program above produces the following error message:

Traceback (most recent call last):
   File "", line 7, in ?
      cursor.execute('select mean_eng_txt from mean where
TypeError: expecting a dictionary, sequence or keyword args

What do I need to do to get this sort of program working?

Richard Schulman
For email reply, remove the xx characters         

More information about the Python-list mailing list