Psylance
Psylance

Reputation: 13

Error: 'tuple' is not callable in python 3

Getting a type error, 'tuple' object is not callable. Any idea what it could be? I am trying to create a program for steganography using DCT.

def write_to_image(path, text):
    img = Image.open(path)
    img.getdata()
    r, g, b = [np.array(x) for x in img.split()]
    lx, ly = r.shape() #Error is here

Upvotes: 1

Views: 240

Answers (2)

Jesse Evers
Jesse Evers

Reputation: 63

As written here: the shape attribute of a Numpy array is an attribute, not a method, and is a tuple.

Try lx, ly = r.shape.

Note that I'm not calling r.shape, I'm just accessing it like you would any other attribute of an object.

Upvotes: 1

Akhilesh_IN
Akhilesh_IN

Reputation: 1327

lx, ly = r.shape

shape will not have ()

Upvotes: 0

Related Questions