Can't instantiate class

Michael P. Soulier msoulier at digitaltorque.ca
Sun Nov 6 09:40:22 EST 2005


On 11/6/05, David Mitchell <dave at dbmdata.com> wrote:
> import DataUtil
>
>    File "C:\Apache2\htdocs\Intranet\addLink.py", line 42, in getCategories
>      db = DataUtil()
>
> TypeError: 'module' object is not callable

You've imported module DataUtil, and by calling DataUtil(), you're
trying to call the module, hence the error. I think you want

db = DataUtil.DataUtil()

Or,

from DataUtil import DataUtil

And then your code will work.

Mike

--
Michael P. Soulier <msoulier at digitaltorque.ca>



More information about the Python-list mailing list