Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19739

Generator problem: parent class not seen

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'script,': 0.07; 'python': 0.08; '(self,': 0.09; 'exception:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrong,': 0.09; 'error:': 0.10; 'output': 0.10; 'def': 0.13; 'argument': 0.15; 'this:': 0.15; 'executed.': 0.16; 'intermittent': 0.16; 'occasionally': 0.16; 'received:washington.edu': 0.16; 'runner': 0.16; 'unbound': 0.16; 'waited': 0.16; 'instance': 0.18; 'subject:problem': 0.19; '(most': 0.21; 'later': 0.21; 'subject:not': 0.21; 'starts': 0.24; 'traceback': 0.24; 'code': 0.25; 'function': 0.27; 'looks': 0.27; 'raise': 0.28; 'script': 0.28; 'odd': 0.28; 'script.': 0.28; 'yield': 0.28; 'problem': 0.29; 'class': 0.29; '(and': 0.29; 'typeerror:': 0.30; '(e.g.': 0.30; 'yet': 0.32; 'header:User- Agent:1': 0.33; 'to:addr:python-list': 0.33; 'last):': 0.34; 'occurs': 0.34; 'try:': 0.34; 'header:X-Complaints-To:1': 0.34; 'file': 0.35; 'run': 0.37; 'passed': 0.37; 'received:org': 0.37; 'why': 0.39; 'except': 0.39; 'being': 0.39; 'called': 0.39; 'subject:: ': 0.39; 'might': 0.40; 'to:addr:python.org': 0.40; 'data': 0.40; 'type': 0.60; 'limit': 0.67; 'failure': 0.74; 'russell': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From "Russell E. Owen" <rowen@uw.edu>
Subject Generator problem: parent class not seen
Date Wed, 01 Feb 2012 13:00:39 -0800
Organization University of Washington
X-Gmane-NNTP-Posting-Host b172-28-191-0.nat.washington.edu
User-Agent MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5322.1328130057.27778.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328130057 news.xs4all.nl 6870 [2001:888:2000:d::a6]:42666
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19739

Show key headers only | View raw


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)?

-- Russell

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Generator problem: parent class not seen "Russell E. Owen" <rowen@uw.edu> - 2012-02-01 13:00 -0800

csiph-web