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


Groups > comp.lang.python > #94668 > unrolled thread

Re: AttributeError: LineLogic instance has no attribute 'probe'

Started byJohn Gordon <gordon@panix.com>
First post2015-07-27 13:43 +0000
Last post2015-07-29 17:32 +0000
Articles 3 — 2 participants

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.


Contents

  Re: AttributeError: LineLogic instance has no attribute 'probe' John Gordon <gordon@panix.com> - 2015-07-27 13:43 +0000
    Re: AttributeError: LineLogic instance has no attribute 'probe' Cameron Simpson <cs@zip.com.au> - 2015-07-28 11:44 +1000
      Re: AttributeError: LineLogic instance has no attribute 'probe' John Gordon <gordon@panix.com> - 2015-07-29 17:32 +0000

#94668 — Re: AttributeError: LineLogic instance has no attribute 'probe'

FromJohn Gordon <gordon@panix.com>
Date2015-07-27 13:43 +0000
SubjectRe: AttributeError: LineLogic instance has no attribute 'probe'
Message-ID<mp5ci3$q3j$1@reader1.panix.com>
In <mailman.1024.1437982246.3674.python-list@python.org> Abder-Rahman Ali <abder.rahman.ali@gmail.com> 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.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

[toc] | [next] | [standalone]


#94682

FromCameron Simpson <cs@zip.com.au>
Date2015-07-28 11:44 +1000
Message-ID<mailman.1041.1438049757.3674.python-list@python.org>
In reply to#94668
On 27Jul2015 13:43, John Gordon <gordon@panix.com> wrote:
>In <mailman.1024.1437982246.3674.python-list@python.org> Abder-Rahman Ali <abder.rahman.ali@gmail.com> 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 <cs@zip.com.au>
Motorcycling is indeed a delightful pastime.    - Honda Rider Training Film

[toc] | [prev] | [next] | [standalone]


#94745

FromJohn Gordon <gordon@panix.com>
Date2015-07-29 17:32 +0000
Message-ID<mpb2nc$ohk$1@reader1.panix.com>
In reply to#94682
In <mailman.1041.1438049757.3674.python-list@python.org> Cameron Simpson <cs@zip.com.au> writes:

> >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.

Ooh, I like your guess better.  :-)


-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web