Class not loading properly in CGI
Tom Chance
tomchance at gmx.net
Sat Nov 22 17:08:19 EST 2003
Jp Calderone wrote:
>> I've got a very, very odd problem here which I can't seem to solve. I'm
>> creating a class instance in a CGI script, but that instance isn't
>> inheriting all of the methods associated with that file. Confused? Here's
>> what I mean:
>>
>> the commands to check:
>> import db
>> mydb = db.mySQL()
>> print str(dir(mydb))
>>
>> done in a python shell on my machine:
>> "['__doc__', '__init__', '__module__', 'connectTime', 'cursor', 'delete',
>> 'fetchRow', 'fetchRows', 'info', 'insert', 'mysql', 'update']"
>>
>> in the cgi script online:
>> ['connectTime', 'cursor', 'mysql']
>>
>> What on earth is going on?
>
> Try printing db.__file__
That shows the correct .py file. Doing a dir() operation on the imported
class itself looks fine though:
db.mySQL (class) : ['__doc__', '__init__', '__module__', 'delete',
'fetchRow', 'fetchRows', 'info', 'insert', 'update']
mydb (class instance) : ['connectTime', 'cursor', 'mysql']
Tom
More information about the Python-list
mailing list