[mod_python] Problem with C extension type

Michael Owens mike at mikesclutter.com
Sat Mar 1 11:07:23 EST 2003


This is a rather intricate problem, but I don't know where else to go. I have 
a C extension in which I created a native Python type, call it X, which has 
two methods: A() and B(). Then I create a Python class, derived from X type, 
called Y, which has has two methods C() and D(). Y is defined as follows 
(cmod is my C extension in which X is implemented)

from cmod import X

class Y(X):
  
    def __new__(cls, db):
        return super(Y, cls).__new__(cls)

    def C():
	print "C()"

    def D():
	print "D()"

If I call Y.A() from a normal python script, there is no problem --- it 
resolved to X.A(). But if I do this inside of mod_python, I get an error 
saying that object Y has no such attribute A. I don't understand why 
mod_python would be any different in attribute resolution than Python would 
be since it is using the same Python implementation/library. I am using 
Python 2.2.2 and mod_python 3.0.1 in Apache 2.x.

Any ideas?

Michael Owens.



More information about the Mod_python mailing list