[Tutor] module object is not callable
paul taney
paultaney at yahoo.com
Thu Sep 18 18:10:06 EDT 2003
Hi,
I am trying to use HTMLgen tor page generation.
Everything was working fine as straight defs,
but whenever I move stuff into a class structure
I get into trouble.
So, to try to get a clue I build a file called
test_class_ctructure.py Here it is:
-----------------
# This graphic represents the structure
#
# (stylesheet)
# |
# -> frontpage, contactpage, resumepage,
trainpage
# | | |
|
#
-----------------------------------------
# |
# V
# generateMyIndex
#
class stylesheet: # no parents
def __init__(self):
print "random_brackets2 I am running..."
class gen_frontpage(stylesheet):
def __init__(self):
print "gen_frontpage I am running..."
class gen_contactpage(stylesheet):
def __init__(self):
print "gen_contactpage I am running.."
class gen_resumepage(stylesheet):
def __init__(self):
print "gen_resumepage I am running..."
class gen_trainpage(stylesheet):
def __init__(self):
print "gen_trainpage I am running..."
class generateMyIndex(gen_frontpage, gen_trainpage,
gen_contactpage, gen_resumepage):
def __init__(self):
print "generateMyIndex I am running
__init__()..."
print "generateMyIndex instantiating 1..."
gen_frontpage.__init__(self)
print "generateMyIndex instantiating 2..."
gen_trainpage.__init__(self)
print "generateMyIndex instantiating 3..."
gen_contactpage.__init__(self)
print "generateMyIndex instantiating 4..."
gen_resumepage.__init__(self)
if __name__ == "__main__":
print "generateMyIndex instantiating me..."
print "++++ main begin ++++"
g = generateMyIndex()
print "++++ main done ++++"
-----------------
Runs well. Here's the output:
$ python test_class_structure.py
generateMyIndex instantiating me...
++++ main begin ++++
generateMyIndex I am running __init__()...
generateMyIndex instantiating 1...
gen_frontpage I am running...
generateMyIndex instantiating 2...
gen_trainpage I am running...
generateMyIndex instantiating 3...
gen_contactpage I am running..
generateMyIndex instantiating 4...
gen_resumepage I am running...
++++ main done ++++
-------------------------------
When I apply this exact structure to my
project space I get the now-dreaded error:
TypeError: 'module' object is not callable
I pulled tutor.mbox and grepped for this but
only got 2 hits.
What am I doing wrong?
Thank you,
paul taney
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
More information about the Tutor
mailing list