1
가끔아래 줄에 다음과 같은 예외를 받고 있어요 :WindowsError (3, '지정된 경로를 찾을 수 없습니다')
WindowsError(3, 'The system cannot find the path specified')
약 1,956 PDF 파일의 한 곳을 (에 경로가 이전에 정의 된) 예외가 43 개에 throw됩니다. 예외가있는 파일 이름 & 경로에 패턴이 표시되지 않습니다.
문제가 무엇인지 제안 해주세요.
totalBytes = 0
if pdfFile.endswith(".pdf") and \
(" permit " in pdfFile or " Permit " in pdfFile):
filename = os.path.join(root, pdfFile)
try:
absolutePath = os.path.abspath(filename)
print ("absolutePath", absolutePath)
# exception on this line, occasionally:
numberOfBytes = os.path.getsize(absolutePath)
print ("numberOfBytes", numberOfBytes)
totalBytes += numberOfBytes
except WindowsError as windowsError:
print (windowsError, filename)
web2py에서 일부 코드로 작업하는 동안이 문제가 발생했습니다. 귀하의 답변 덕분에 그것을 해결할 수있었습니다. –