程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

PyThon Debug采坑--提示 module ‘thread‘ has no attribute ‘start_new_thread‘

編輯:Python

PyThon Debug

C:\Users\Administrator\.IntelliJIdea2018.1\config\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_resolver.py:127: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if found.get(name) is not 1:
pydev debugger: starting
Connected to pydev debugger (build 181.5540.7)
Traceback (most recent call last):
File "C:\Users\Administrator\.IntelliJIdea2018.1\config\plugins\python-ce\helpers\pydev\pydevd.py", line 1664, in <module>
main()
File "C:\Users\Administrator\.IntelliJIdea2018.1\config\plugins\python-ce\helpers\pydev\pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Users\Administrator\.IntelliJIdea2018.1\config\plugins\python-ce\helpers\pydev\pydevd.py", line 1044, in run
self.prepare_to_run()
File "C:\Users\Administrator\.IntelliJIdea2018.1\config\plugins\python-ce\helpers\pydev\pydevd.py", line 962, in prepare_to_run
self.patch_threads()
File "C:\Users\Administrator\.IntelliJIdea2018.1\config\plugins\python-ce\helpers\pydev\pydevd.py", line 983, in patch_threads
patch_thread_modules()
File "C:\Users\Administrator\.IntelliJIdea2018.1\config\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 656, in patch_thread_modules
patch_thread_module(t)
File "C:\Users\Administrator\.IntelliJIdea2018.1\config\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 622, in patch_thread_module
_original_start_new_thread = thread._original_start_new_thread = thread.start_new_thread
AttributeError: module 'thread' has no attribute 'start_new_thread'
  • 有如上錯誤提示,表示的意思是thread方法中沒有start_new_thread的屬性
    • 網上搜索得到的答案都是:包含了thread.py的文件與系統文件重名,重命名一下即可
  • 經過排查後,發現文件中的確沒有對應的thread.py,但是有一個包名thread,修改後即可

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved