请问有谁搭建多线程时遇到过 AttributeError: 'list' object has no attribute 'Thread'这个错误吗?

import threading1
import os
import time
threading1 = []
start = time.clock()
Currentpath = os.getcwd()

print ("Currentpath==> "+Currentpath)
print ("*****************************************")
DirList = os.listdir(Currentpath)
print (DirList)

def Getposition(file):
StrEnd = file[-7:]
if StrEnd == "Sum.txt":
filepath = Currentpath + "\" + folder + "\" + file
print("==> " + filepath)
result = []
with open(filepath, 'r') as f:
for lines in f.readlines():
txts = lines.split(' ')
print(txts[-3:])
tem = ','.join(txts[-3:])
with open(file + '-2.csv', 'a') as fcsv:
fcsv.writelines(tem)

for folder in DirList:
if os.path.isdir(Currentpath+"\"+folder):
print("*****************************************")
print("Now working folder==> "+folder)
Files = os.listdir(Currentpath+"\"+folder)
print(Files)
print("*****************************************")
list1 = range(len(Files))
print(list1)
if name== '__main__' :
for i in list1:
t = threading1.Thread(target=Getposition, args=(Files[i]))
print(threading1)
threading1.append(t)
for i in list1:
threading1[i].start()
for i in list1:
threading1[i].join()

print ("***************Finished!!!***************")
end=time.clock()
times=end-start
print("runtime:"+str(times))

1个回答

lanshuang89
lanshuang89 这个我也看了,和我的错误不一样,我的脚本命名和模块完全没有冲突。
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

1
python 使用with con:连接数据库时 报错AttributeError: __enter__怎么解决呢?
2
python报错:AttributeError: module 'curses' has no attribute 'wrapper'
2
出现AttributeError: 'NoneType' object has no attribute 'text'错误,无法解决....能答否?
1
调用anaconda下的sklearn时,出现AttributeError: 'bool' object has no attribute 'any'
1
报错 AttributeError:module 'tensorflow' has no attribute 'gfile'
2
Python 创建Dog类时 报错AttributeError: 'Dog' object has no attribute 'sit'
1
运行mixmatch源码CIFAR10数据集时报错AttributeError: 'CIFAR10' object has no attribute 'targets',是怎么回事?
1
树莓派opencv错误AttributeError: 'cv2.face_LBPHFaceRecognizer' object has no attribute 'read'?
0
AttributeError: module 'scipy' has no attribute 'io'
1
AttributeError: 'NoneType' object has no attribute 'append'
0
NS3进行可视化编译时出错AttributeError: 'module' object has no attribute 'require_foreign'
1
tensorflow :AttributeError: module 'tensorflow' has no attribute 'placeholder'
1
AttributeError: module 'xlwt' has no attribute 'Workbook'急求问题解答
0
Python->Pyecharts->Geo在地图中加入自定义的点报错:AttributeError: 'NoneType' object has no attribute 'add'。
1
新人使用pycharm运行飞机大战项目报如下错误:AttributeError: module 'pygame.image' has no attribute 'get_rect'
1
DenseFeature作为函数式API的第一层时报AttributeError: 'DenseFeatures' object has no attribute 'shape';该怎么解决啊。
2
AttributeError: 'NoneType' object has no attribute 'shape'求指导
2
求助,python 报错:AttributeError: module 'log0' has no attribute 'out'怎么办?
2
出现AttributeError: 'NoneType' object has no attribute 'to_csv'该怎么解决
1
AttributeError: module 'keras.backend' has no attribute 'set_image_dim_ordering'