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: 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 In-Reply-To: Date: Wed, 1 Feb 2012 14:50:19 -0800 Content-Transfer-Encoding: quoted-printable References: To: Chris Rebert 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Feb 1, 2012, at 2:34 PM, Chris Rebert wrote: > On Wed, Feb 1, 2012 at 1:00 PM, Russell E. Owen wrote: >> I have an odd and very intermittent problem in Python script. >> Occasionally it fails with this error: >>=20 >> 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) > >> The code looks like this: >>=20 >> def run(self, sr): >> try: >> self.initAll() > >> 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)? >=20 > 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 =3D None, defRadius =3D 5.0, defBinFactor =3D 1, maxFindAmpl =3D None, doWindow =3D False, windowOrigin =3D 1, windowIsInclusive =3D True, doZeroOverscan =3D False, helpURL =3D None, debug =3D False, ): ... BaseFocusScript.__init__(self, sr =3D sr, gcamActor =3D gcamActor, instName =3D instName, imageViewerTLName =3D imageViewerTLName, defRadius =3D defRadius, defBinFactor =3D defBinFactor, maxFindAmpl =3D maxFindAmpl, doWindow =3D doWindow, windowOrigin =3D windowOrigin, windowIsInclusive =3D windowIsInclusive, helpURL =3D helpURL, debug =3D debug, ) self.doZeroOverscan =3D 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 =3D self.exposeModel.bin.getInd(0)[0] Also, here is BaseFocusScript: class BaseFocusScript(object): """Basic focus script object. =20 This is a virtual base class. The inheritor must: - Provide widgets - Provide a "run" method """ cmd_Find =3D "find" cmd_Measure =3D "measure" cmd_Sweep =3D "sweep" # constants #DefRadius =3D 5.0 # centroid radius, in arcsec #NewStarRad =3D 2.0 # amount of star position change to be = considered a new star DefFocusNPos =3D 5 # number of focus positions DefFocusRange =3D 200 # default focus range around current focus FocusWaitMS =3D 1000 # time to wait after every focus adjustment = (ms) BacklashComp =3D 0 # amount of backlash compensation, in microns (0 = for none) WinSizeMult =3D 2.5 # window radius =3D centroid radius * = WinSizeMult FocGraphMargin =3D 5 # margin on graph for x axis limits, in um MaxFocSigmaFac =3D 0.5 # maximum allowed sigma of best fit focus as = a multiple of focus range MinFocusIncr =3D 10 # minimum focus increment, in um def __init__(self, sr, gcamActor, instName, tccInstPrefix =3D None, imageViewerTLName =3D None, defRadius =3D 5.0, defBinFactor =3D 1, finalBinFactor =3D None, canSetStarPos =3D True, maxFindAmpl =3D None, doWindow =3D True, windowOrigin =3D 0, windowIsInclusive =3D True, helpURL =3D None, debug =3D False, ): """....""" self.sr =3D sr self.sr.debug =3D bool(debug) self.gcamActor =3D gcamActor .... def initAll(self): """Initialize variables, table and graph. """ # initialize shared variables self.doTakeFinalImage =3D False self.focDir =3D None self.currBoreXYDeg =3D None self.begBoreXYDeg =3D None self.instScale =3D None self.arcsecPerPixel =3D None self.instCtr =3D None self.instLim =3D None self.cmdMode =3D None self.focPosToRestore =3D None self.expTime =3D None self.absStarPos =3D None self.relStarPos =3D None self.binFactor =3D None self.window =3D None # LL pixel is 0, UR pixel is included self.enableCmdBtns(False)