TypeError: object is not callable

Paul Prescod paulp at ActiveState.com
Wed Jun 6 21:24:54 EDT 2001


Gustaf Liljegren wrote:
> 
> Why this error?
> 
> I have done a class which is in placed in a directory within sys.path, and
> the class works as intended when I test it by adding some main() code in
> it. But when I call it from another module I get this strange error
> "TypeError: object is not callable". No way I can get the same error in
> Idle...

I'm going to guess that you have a class Friend in a module called
Friend.py and then do this:

import Friend

f = Friend()

You need to do this:

f = Friend.Friend()

If that isn't the answer, I'll need more info.

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook




More information about the Python-list mailing list