Access Issues

Fredrik Lundh fredrik at pythonware.com
Wed Mar 21 16:29:38 CET 2001


Clodagh O'Rourke wrote:
> I wonder if anyone can help.
>
> I am trying call the constructor of the EnvVar class from the
> newEnvWin function of the Cell class.  But I am getting the
> following error
>
> Exception in Tkinter callback
> Traceback (innermost last):
>   File "/usr/vob/omc_reference/ThirdParty/scriptSources/lib/python1.5/lib-tk/Tkinter.py", line 764, in __call__
>     return apply(self.func, args)
>   File "Cell.py", line 63, in newCellMgt
>     self.newEnvWin('cellmgt')
>   File "Cell.py", line 60, in newEnvWin
>     instance = EnvVar.__init__(g, self.parent)
> AttributeError: __init__
>
> I have include some extracts of the code.

__init__ is not a constructor; it's the function called by the
constructor to initialize an instance.

(and in your case, EnvVar appears to be a module, not a class)

try replacing

       instance = EnvVar.__init__(g, self.parent)

with

       instance = EnvVar.EnvVar(g, self.parent)

Cheers /F





More information about the Python-list mailing list