[Tutor] 'module' object has no attribute (setting a class attribute)
tim at johnsons-web.com
Fri Oct 15 23:20:37 CEST 2010
My intention is to set a class attribute so that any number of
instantiations will have this value.
the module is tmpl.py. the class is tmpl.
if from the script I do this:
tmpl.tmpl.templatepath = kbLib.templatepath
I get error message:
'module' object has no attribute 'templatepath'
I ended up getting completely befuddled, and then realized that the
problem was the right side of the assignment statement. I.E. I had
a typo on the right and python was not informing me of *which*
module didn't have the attribute
I have two questions regarding this:
1)Am I using the correct method to set a class attribute?
2)Is there a system configuration that would cause the
AttributeError exception to print out the module name.
(In this cause it was 'kbLib' not 'tmpl'.
tim at johnsons-web.com or akwebsoft.com
More information about the Tutor