What does Error: 'module' object is not callable Mean?

MRAB python at mrabarnett.plus.com
Sun Mar 14 14:46:29 EDT 2010


  Cal Who wrote:
> The below code produces the error as indicated. But, in
>  E:\Python26\Lib\site-packages\ffnet\tools I see:
>     drawffnet.py
>     drawffnet.pyc
>     drawffnet.pyo
> Is that what it is looking for?
> 
> I'm not sure what "not callable" means.
> Could it be referencing to "nn" rather than drawffnet?
> What should I do to investigate this?
> 
> Thanks
> from ffnet import ffnet, mlgraph, readdata
> 
> ...snipped working code here ...
> 
> output, regression = nn.test(inputs2, targets2, iprint = 2)
> 
> from ffnet.tools import drawffnet
> import pylab
> drawffnet(nn)   #Error: 'module' object is not callable
> pylab.show()
> except ImportError, e:
> print "Cannot make drawffnet plot." 
> 
You're importing the module 'drawffnet' and then trying to call it in:

     drawffnet(nn)

but, as the traceback says, modules can't be called.

I had a quick look at the documentation and it looks like you should be
calling a function called 'drawffnet' that's defined in the module
called 'drawffnet'. Try doing:

     from ffnet.tools.drawffnet import drawffnet

instead.



More information about the Python-list mailing list