最近写了一个下载图片的爬虫,调试的时候没有任何问题,但是代码运行时间长了
以后就会报错终止
old_path=image_store+''.join(image_paths)
new_path=image_store+image_paths[0].split('\\')[0]+'\\'+item['imagePath']
print("new path is "+new_path)
if not os.path.exists(new_path):
os.mkdir(new_path)
os.rename(old_path,new_path+'\\'+image_paths[0].split('\\')[1])
return item
我是给这个文件做了个重命名,放到指定的文件夹,,为什么总是运行一段时间就会报错