strange TypeError exception in function compiled from a string

N

nelson

Hi all,
I have this function, defined in a string and ecetuted through ad
exec call

def cell1(d):

x=d.get('x')
print x

import y
return y.add(y.add(self.adf0(x),self.adf0(x)),self.adf0(x))


d is a dict of this kind {'x':2}

I receive the following exception, that i find very strange...

File "<string>", line 7, in cell1
TypeError: 'dict' object is not callable

I have tested all the function al line 7, and none of them raise any
exception.
Have anyone some suggestion on how to solve this?

thanks!
 
B

bruno.desthuilliers

Hi all,
  I have this function, defined in a string and ecetuted through ad
exec call

def cell1(d):

    x=d.get('x')
    print x

    import y
    return y.add(y.add(self.adf0(x),self.adf0(x)),self.adf0(x))

d is a dict of this kind {'x':2}

I receive the following exception, that i find very strange...

  File "<string>", line 7, in cell1
TypeError: 'dict' object is not callable

I have tested all the function al line 7, and none of them raise any
exception.
Have anyone some suggestion on how to solve this?

Not without the minimal executable code reproducing your error.
 
M

MRAB

Hi all,
I have this function, defined in a string and ecetuted through ad
exec call

def cell1(d):

x=d.get('x')
print x

import y
return y.add(y.add(self.adf0(x),self.adf0(x)),self.adf0(x))


d is a dict of this kind {'x':2}

I receive the following exception, that i find very strange...

File "<string>", line 7, in cell1
TypeError: 'dict' object is not callable

I have tested all the function al line 7, and none of them raise any
exception.
Have anyone some suggestion on how to solve this?
A call looks like foo(), so probably either y.add or self.adf0 is a
dict. Print both of them to check.
 
P

Piet van Oostrum

Hi all,
I have this function, defined in a string and ecetuted through ad
exec call

def cell1(d):

x=d.get('x')
print x

import y
return y.add(y.add(self.adf0(x),self.adf0(x)),self.adf0(x))
What is self in line 7?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top