What does Error: 'module' object is not callable Mean?
Benjamin Kaplan
benjamin.kaplan at case.edu
Sun Mar 14 14:41:25 EDT 2010
On Sun, Mar 14, 2010 at 2:20 PM, Cal Who <CalWhoNOSPAM at roadrunner.com>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."
>
>
In Python, everything is an object. Certain objects, like functions, are
callable. Other objects, like modules are not. You have a module mapped to
the name "drawffnet". Python tries to call that object, but it isn't
callable. If there is a function drawffnet inside the drawffnet module (I'm
not familiar with the package, so I don't know), you need to call that
specifically.
drawffnet.drawffnet(nn)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100314/b80d84e3/attachment-0001.html>
More information about the Python-list
mailing list