/home/python/.virtualenvs/django_py3/bin/python /home/python/Desktop/demo/tcp/threading.py
Traceback (most recent call last):
File "/home/python/Desktop/demo/tcp/threading.py", line 30, in <module>
main()
File "/home/python/Desktop/demo/tcp/threading.py", line 22, in main
t1 = threading.Thread(target=download_music)
AttributeError: module 'threading' has no attribute 'Thread'
Exception ignored in: <module 'threading' from '/home/python/Desktop/demo/tcp/threading.py'>
AttributeError: module 'threading' has no attribute '_shutdown'
Process finished with exit code 1
写了一个线程的demo,名字叫threading.py,在程序中使用了threading.Thread,报错。
原因是自己编写的文件和系统中的文件名重名,优先使用了自己写的threading文件。
网友评论