python出现TypeError: 'module' object is not callable错误

来源:互联网 发布:俄罗斯 叙利亚 知乎 编辑:程序博客网 时间:2024/06/07 16:33

由于工作原因经常会写一个类来重复调用,但是偶尔会出现TypeError: 'module' object is not callable错误

  File "/home/yu/Downloads/cp0/people/views.py", line 116, in test_o
    owner = str(Patches(data).owner)
TypeError: 'module' object is not callable


经过检查多次发现类在调用的时候在views.py中直接import Patches(包含该类的py是Patches.py)

使用from Patches import Patches调用即可




阅读全文
0 0