[mod_python] "TypeError: argument 2 must be a mapping" and other things

Daniel Winkler mailings at danielwinkler.de
Tue Sep 20 17:43:07 EDT 2005

Hello together,

I am trying to write a little web application with Apache2, mod_python
and MySQL. Unfortunately I have to fight with some strange effects:

  acl = db.cursor()
  acl.execute("SELECT * FROM acl WHERE c = %s AND d = %s;",
              (cID, dID))
with cID and dID as integers causes an "TypeError: argument 2 must be a
mapping". Sometimes. I tried to restart the apache server and -- it
worked, but after reloading the SAME page without any modifications this
error occured again, also on similar SQL statements in other parts of
the code.
I already checked the arguments: They are just normal integers.
I tested the code with the interactive interface: everything worked
fine. (the code sniplet mentioned above is independet from Apache and
special mod_python features)

Could someone please give me a hint how to debug this and to avoid these
(non-deterministic) errors? What might I have done wrong?

Daniel Winkler

More information about the Mod_python mailing list