Generator problem: parent class not seen

Russell Owen rowen at uw.edu
Thu Feb 2 01:19:51 CET 2012


On Feb 1, 2012, at 3:35 PM, Arnaud Delobelle wrote:
> On Feb 1, 2012 9:01 PM, "Russell E. Owen" <rowen at uw.edu> wrote:
> >
> > I have an odd and very intermittent problem in Python script.
> > Occasionally it fails with this error:
> >
> > Traceback (most recent call last):
> >  File
> > "/Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
> > eFocusScript.py", line 884, in run
> >  File
> > "/Applications/APO/TTUI.app/Contents/Resources/lib/python2.7/TUI/Base/Bas
> > eFocusScript.py", line 1690, in initAll
> > TypeError: unbound method initAll() must be called with BaseFocusScript
> > instance as first argument (got ScriptClass instance instead)
> > self=<ScriptClass object at 0x2066b410>; class hierarchy=[(<class
> > 'TUI.Base.BaseFocusScript.ImagerFocusScript'>, (<class
> > 'TUI.Base.BaseFocusScript.BaseFocusScript'>,)), [(<class 'ScriptClass'>,
> > (<class 'TUI.Base.BaseFocusScript.ImagerFocusScript'>,))]]
> >
> 
> Looks like you have loaded the same module twice.  So you have two versions of your class hierarchies. You can check by printing the ids of your classes. You will get classes with the same name but different ids.
> 
> Arnaud
> 

Yes! I was reloading BaseFocusScript. Oops.

In detail: script files are dynamically loaded when first requested and can be reloaded for debugging. I think that's safe because script files are self-contained (e.g. the classes in them are never subclassed or anything like that). But I went too far: I had my focus scripts reload BaseFocusScript, which is shared code, so that I could tweak BaseFocusScript while debugging focus scripts.

Thank you very much!

-- Russell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120201/b12a4906/attachment.html>


More information about the Python-list mailing list