AttributeError: LineLogic instance has no attribute 'probe'
Cameron Simpson
cs at zip.com.au
Mon Jul 27 21:44:28 EDT 2015
On 27Jul2015 13:43, John Gordon <gordon at panix.com> wrote:
>In <mailman.1024.1437982246.3674.python-list at python.org> Abder-Rahman Ali <abder.rahman.ali at 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 at zip.com.au>
Motorcycling is indeed a delightful pastime. - Honda Rider Training Film
More information about the Python-list
mailing list