当前位置:网站首页>'module 'object is not callable error

'module 'object is not callable error

2022-07-07 11:16:00 ITSOK_ U

python Report errors :TypeError: ‘module’ object is not callable(“ modular ” Object is not callable )

  • The specific code is posted below , I can't find what went wrong , I thought it was the wrong class name, which should be lowercase , Finally, looking back, it turned out to be my own py The file name is also coverage.py.
import coverage
import unittest

if __name__ == "__main__":
    #  Instantiate objects 
    cov = coverage.coverage()
    #  To analyze 
    cov.start()```
  • This causes the imported module to be named the same as the program file written by yourself , Obviously, the file module written by yourself is imported here , Not imported coverage.
  • terms of settlement : Change the name of the program file , as follows : Right click the program file with the mouse , Or shortcut key shift+F6,
原网站

版权声明
本文为[ITSOK_ U]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070917327677.html