• AttributeError: 'module' object has no attribute 'Thread'


    $ python thread.py
    starting at: 2015-08-05 00:24:24
    Traceback (most recent call last):
      File "thread.py", line 28, in <module>
        main()
      File "thread.py", line 16, in main
        th = threading.Thread(target= test,args= (i,2))
    AttributeError: 'module' object has no attribute 'Thread'
    Exception AttributeError: '_shutdown' in <module 'threading' from '/home/tim/Desktop/sourceeeeeeeeeeeeeeee//threading.pyc'> ignored

    Check that you have not named your script threading.py

    8 down vote accepted

    I bet you have a local file named threading.py, and it's masking the system threading module.

    You can verify this by printing threading.__file__:

    import threading
    print threading.__file__
    

    to get the file path of the module that is being imported.

    Rename it, or delete it, to fix this.

  • 相关阅读:
    modf()函数
    面向对象编程五大原则
    .Net网络资源
    整理CentOS常用命令
    在RHEL5上安装oracle10gLinux
    strchr()函数
    swab函数
    Strstr()函数
    tmpnam函数
    strdup ()函数
  • 原文地址:https://www.cnblogs.com/timssd/p/4703551.html
Copyright © 2020-2023  润新知