Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19750 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2012-02-02 00:15 +0100 |
| Last post | 2012-02-02 00:15 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Generator problem: parent class not seen Peter Otten <__peter__@web.de> - 2012-02-02 00:15 +0100
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2012-02-02 00:15 +0100 |
| Subject | Re: Generator problem: parent class not seen |
| Message-ID | <mailman.5331.1328138107.27778.python-list@python.org> |
Russell E. Owen 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'>,))]]
>
> The code looks like this:
>
> def run(self, sr):
> try:
> self.initAll()
> ....
> except Exception:
> traceback.print_exc(file=sys.stderr)
> sys.stderr.write("self=%r; class hierarchy=%s\n" % (self,
> inspect.getclasstree([type(self)])))
> raise
>
> As a detail that may be important: the code is a generator that is being
> run by a script runner class (an instance of which is passed into the
> run function as argument sr). When the user starts a script the script
> runner calls the script's "run" generator. The script runner calls the
> run generator again later when conditions are right (e.g. data that is
> being waited for arrives, a time limit is reached...). In this case the
> failure occurs at the very start of the script, so a yield has not yet
> executed.
>
> I am puzzled why Python thinks the class type is wrong, given the output
> of inspect.getclasstree. Any ideas on what might be wrong and how to
> track it down (and why it would be so intermittent)?
Do you reload()?
Back to top | Article view | comp.lang.python
csiph-web