Path: csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed8.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'context': 0.05; 'error:': 0.05; 'definitions': 0.07; "'''": 0.09; '__init__': 0.09; 'attribute.': 0.09; 'logic': 0.09; 'example:': 0.10; 'def': 0.13; 'skip:p 40': 0.15; '>in': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'subject:instance': 0.16; 'wrote:': 0.16; 'string': 0.17; 'attribute': 0.18; 'posted': 0.21; 'doc': 0.22; 'cheers,': 0.22; 'code,': 0.23; "haven't": 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'function': 0.28; 'actual': 0.28; 'program,': 0.29; 'code': 0.30; 'class.': 0.30; 'guess': 0.31; 'another': 0.32; 'skip:_ 10': 0.32; 'class': 0.33; 'received:com.au': 0.33; 'definition': 0.34; 'running': 0.34; 'i.e.': 0.35; 'instance': 0.35; 'problem.': 0.35; 'but': 0.36; 'instead': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'charset:us-ascii': 0.37; 'skip:v 20': 0.38; 'data': 0.39; 'to:addr:python.org': 0.40; 'john': 0.61; 'default': 0.61; 'subject:skip:A 10': 0.63; 'different': 0.63; 'complete': 0.63; 'cameron': 0.66; 'film': 0.72; 'training': 0.78; '--->': 0.84; 'clearer': 0.84; 'honda': 0.84; 'probe': 0.91; 'ali': 0.95 Date: Tue, 28 Jul 2015 11:44:28 +1000 From: Cameron Simpson To: python-list@python.org Subject: Re: AttributeError: LineLogic instance has no attribute 'probe' MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) References: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=eZjABOwH c=1 sm=1 tr=0 a=7VRakydLWw4CnqwyGz1TSg==:117 a=7VRakydLWw4CnqwyGz1TSg==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=vrnE16BAAAAA:8 a=yEdEr6MRgwAA:10 a=kj9zAlcOel0A:10 a=zOBTXjUuO1YA:10 a=VUfPOBp7AAAA:8 a=8AHkEIZyAAAA:8 a=pGLkceISAAAA:8 a=_kwmMcC5Z3sQ0q-rdnkA:9 a=CjuIK1q_8ugA:10 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1438049757 news.xs4all.nl 2831 [2001:888:2000:d::a6]:56292 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94682 On 27Jul2015 13:43, John Gordon wrote: >In Abder-Rahman Ali writes: >> In the class ---> LineLogic > >> def __init__(self): >> self.probe = vtk.vtkProbeFilter() > >> In another class ---> LineLogicTest > >> logic = LineLogic() >> probe = logic.probe >> data = probe.GetOutput().GetPointData().GetScalars() > >> When I try running the program, I get the following error: > >> AttributeError: LineLogic instance has no attribute 'probe' > >Since you haven't posted the actual complete code, we can only guess >at the problem. > >My guess is that you have two different definitions of the LineLogic >class, one of them lacking the probe attribute. Alternatively, if the code he did quote is accurate, he may have not indented the definition of __init__. Example: class LineLogic(object): ''' doc string ''' def __init__(self): ... This is legal, but wrong. It will result in LineLogic having the default initialisation i.e. nothing, as the __init__ function is not part of the class. But yes, this would all be clearer had the OP posted the code instead of a tiny out of context snippet. Cheers, Cameron Simpson Motorcycling is indeed a delightful pastime. - Honda Rider Training Film