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


Groups > comp.lang.python > #19749

Re: Generator problem: parent class not seen

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rowen@uw.edu>
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; 'debug': 0.03; '"""': 0.07; 'initialize': 0.07; 'pixel': 0.07; 'python': 0.08; 'context.': 0.09; 'false,': 0.09; 'graph': 0.09; 'must:': 0.09; 'none)': 0.09; 'variables,': 0.09; 'wrong,': 0.09; 'error:': 0.10; 'output': 0.10; 'def': 0.13; 'argument': 0.15; 'cc:addr:python-list': 0.15; 'this:': 0.15; '"""basic': 0.16; 'adjustment': 0.16; 'constants': 0.16; 'factor,': 0.16; 'intermittent': 0.16; 'like?': 0.16; 'occasionally': 0.16; 'received:140.142': 0.16; 'received:140.142.32': 0.16; 'received:140.142.33': 0.16; 'received:cac.washington.edu': 0.16; 'received:smtp.washington.edu': 0.16; 'received:washington.edu': 0.16; 'sigma': 0.16; 'unbound': 0.16; 'wrote:': 0.16; 'wed,': 0.17; 'instance': 0.18; 'subject:problem': 0.19; '(most': 0.21; 'subject:not': 0.21; 'cc:no real name:2**0': 0.21; 'feb': 0.22; 'header:In-Reply-To:1': 0.22; 'helpful': 0.23; 'axis': 0.23; 'received:140': 0.23; 'traceback': 0.24; 'cc:2**0': 0.25; 'code': 0.25; 'pm,': 0.26; 'looks': 0.27; 'script': 0.28; 'odd': 0.28; 'script.': 0.28; 'true,': 0.28; 'problem': 0.29; 'skip:b 20': 0.29; 'cc:addr:python.org': 0.29; 'class': 0.29; '(and': 0.29; 'lines': 0.30; 'none,': 0.30; 'object.': 0.30; 'offending': 0.30; 'preceding': 0.30; 'typeerror:': 0.30; 'x-mailer:apple mail (2.1084)': 0.30; 'chris': 0.30; 'skip:b 30': 0.30; 'shared': 0.31; 'go.': 0.32; 'initial': 0.32; 'last):': 0.34; 'try:': 0.34; '...': 0.35; 'record': 0.35; 'window': 0.35; 'file': 0.35; 'none': 0.36; 'class.': 0.36; 'variables': 0.36; 'skip:" 10': 0.36; 'charset:us- ascii': 0.36; 'run': 0.37; 'skip:_ 10': 0.37; 'bin': 0.38; 'why': 0.39; "what's": 0.39; 'focus': 0.39; 'called': 0.39; 'subject:: ': 0.39; 'change': 0.40; 'might': 0.40; 'range': 0.60; 'type': 0.60; 'positions': 0.61; '1000': 0.62; 'header:Message-Id:1': 0.62; 'marked': 0.64; 'here': 0.64; 'maximum': 0.66; 'relevant': 0.70; '***': 0.73; '1:00': 0.84; '2012,': 0.84; '5.0': 0.84; 'limits,': 0.84; 'margin': 0.84; 'owen': 0.84; 'russell': 0.91
X-Auth-Received from d-172-28-191-49.dhcp4.washington.edu (D-172-28-191-49.dhcp4.washington.edu [172.28.191.49]) (authenticated authid=rowen) by smtp.washington.edu (8.14.4+UW11.03/8.14.4+UW11.03) with ESMTP id q11MoJEg008491 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 1 Feb 2012 14:50:19 -0800
Subject Re: Generator problem: parent class not seen
Mime-Version 1.0 (Apple Message framework v1084)
Content-Type text/plain; charset=us-ascii
From Russell Owen <rowen@uw.edu>
In-Reply-To <CAMZYqRSD1OEjLNTYLMQ2ZS6cXK1r7H9yDHBf0GzFpjE6jd4PqA@mail.gmail.com>
Date Wed, 1 Feb 2012 14:50:19 -0800
Content-Transfer-Encoding quoted-printable
References <rowen-5B5D5C.13003901022012@news.gmane.org> <CAMZYqRSD1OEjLNTYLMQ2ZS6cXK1r7H9yDHBf0GzFpjE6jd4PqA@mail.gmail.com>
To Chris Rebert <crebert@ucsd.edu>
X-Mailer Apple Mail (2.1084)
X-PMX-Version 5.5.9.388399, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.2.1.223914
X-PMX-Server mxout11.cac.washington.edu
X-Uwash-Spam Gauge=IIIIIIII, Probability=8%, Report=' BODY_SIZE_4000_4999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, FROM_EDU_TLD 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MIME_VERSION_APPLEMAIL 0, __MSGID_APPLEMAIL 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT_APPLEMAIL 0, __X_MAILER_APPLEMAIL 0'
Cc python-list@python.org
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.5330.1328137483.27778.python-list@python.org> (permalink)
Lines 154
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328137483 news.xs4all.nl 6958 [2001:888:2000:d::a6]:39448
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19749

Show key headers only | View raw


On Feb 1, 2012, at 2:34 PM, Chris Rebert wrote:

> On Wed, Feb 1, 2012 at 1:00 PM, Russell E. Owen <rowen@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)
> <snip>
>> The code looks like this:
>> 
>>    def run(self, sr):
>>        try:
>>            self.initAll()
> <snip>
>> 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)?
> 
> What's the offending line of initAll() [#1690 in BaseFocusScript.py]
> look like? The lines preceding it would also be helpful for context.

Here you go. The offending line #169 is marked with ***

-- Russell

class ImagerFocusScript(BaseFocusScript):
   """..."""
    def __init__(self,
        sr,
        instName,
        imageViewerTLName = None,
        defRadius = 5.0,
        defBinFactor = 1,
        maxFindAmpl = None,
        doWindow = False,
        windowOrigin = 1,
        windowIsInclusive = True,
        doZeroOverscan = False,
        helpURL = None,
        debug = False,
    ):
    ...
        BaseFocusScript.__init__(self,
            sr = sr,
            gcamActor = gcamActor,
            instName = instName,
            imageViewerTLName = imageViewerTLName,
            defRadius = defRadius,
            defBinFactor = defBinFactor,
            maxFindAmpl = maxFindAmpl,
            doWindow = doWindow,
            windowOrigin = windowOrigin,
            windowIsInclusive = windowIsInclusive,
            helpURL = helpURL,
            debug = debug,
        )
        self.doZeroOverscan = bool(doZeroOverscan)
        ....

    def initAll(self):
        """Override the default initAll to record initial bin factor, if relevant
        """
***   BaseFocusScript.initAll(self)
        if self.exposeModel.instInfo.numBin > 0:
            self.finalBinFactor = self.exposeModel.bin.getInd(0)[0]


Also, here is BaseFocusScript:

class BaseFocusScript(object):
    """Basic focus script object.
    
    This is a virtual base class. The inheritor must:
    - Provide widgets
    - Provide a "run" method
    """
    cmd_Find = "find"
    cmd_Measure = "measure"
    cmd_Sweep = "sweep"

    # constants
    #DefRadius = 5.0 # centroid radius, in arcsec
    #NewStarRad = 2.0 # amount of star position change to be considered a new star
    DefFocusNPos = 5  # number of focus positions
    DefFocusRange = 200 # default focus range around current focus
    FocusWaitMS = 1000 # time to wait after every focus adjustment (ms)
    BacklashComp = 0 # amount of backlash compensation, in microns (0 for none)
    WinSizeMult = 2.5 # window radius = centroid radius * WinSizeMult
    FocGraphMargin = 5 # margin on graph for x axis limits, in um
    MaxFocSigmaFac = 0.5 # maximum allowed sigma of best fit focus as a multiple of focus range
    MinFocusIncr = 10 # minimum focus increment, in um
    def __init__(self,
        sr,
        gcamActor,
        instName,
        tccInstPrefix = None,
        imageViewerTLName = None,
        defRadius = 5.0,
        defBinFactor = 1,
        finalBinFactor = None,
        canSetStarPos = True,
        maxFindAmpl = None,
        doWindow = True,
        windowOrigin = 0,
        windowIsInclusive = True,
        helpURL = None,
        debug = False,
    ):
        """...."""
        self.sr = sr
        self.sr.debug = bool(debug)
        self.gcamActor = gcamActor

    ....
    def initAll(self):
        """Initialize variables, table and graph.
        """
        # initialize shared variables
        self.doTakeFinalImage = False
        self.focDir = None
        self.currBoreXYDeg = None
        self.begBoreXYDeg = None
        self.instScale = None
        self.arcsecPerPixel = None
        self.instCtr = None
        self.instLim = None
        self.cmdMode = None
        self.focPosToRestore = None
        self.expTime = None
        self.absStarPos = None
        self.relStarPos = None
        self.binFactor = None
        self.window = None # LL pixel is 0, UR pixel is included

        self.enableCmdBtns(False)

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


Thread

Re: Generator problem: parent class not seen Russell Owen <rowen@uw.edu> - 2012-02-01 14:50 -0800

csiph-web