######在使用shutil.copy时报错
OSError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_13760\526975701.py in
2 Invoice_Required = [x for x in file_list if i in x]
3 for file in Invoice_Required:
----> 4 shutil.copy(file,Storing_Source)
5
for i in tqdm(Invoice_List):
Invoice_Required = [x for x in file_list if i in x]
for file in Invoice_Required:
shutil.copy(file,Storing_Source)
~\Anaconda3\lib\shutil.py in copy(src, dst, follow_symlinks)
425 if os.path.isdir(dst):
426 dst = os.path.join(dst, os.path.basename(src))
--> 427 copyfile(src, dst, follow_symlinks=follow_symlinks)
428 copymode(src, dst, follow_symlinks=follow_symlinks)
429 return dst
~\Anaconda3\lib\shutil.py in copyfile(src, dst, follow_symlinks)
282 # https://github.com/python/cpython/pull/7160#discussion_r195405230
283 elif _WINDOWS and file_size > 0:
--> 284 _copyfileobj_readinto(fsrc, fdst, min(file_size, COPY_BUFSIZE))
285 return dst
286
~\Anaconda3\lib\shutil.py in _copyfileobj_readinto(fsrc, fdst, length)
186 with memoryview(bytearray(length)) as mv:
187 while True:
--> 188 n = fsrc_readinto(mv)
189 if not n:
190 break
OSError: [Errno 22] Invalid argument
新年快乐🎉,望采纳,谢谢!
可能是因为你传递给函数的参数无效或不正确。请检查参数是否正确,或者更改参数让其有效。