프로그램이 실행될 때 TemporaryDirectory()에서 속성 오류가 발생합니다.

프로그램이 실행될 때 TemporaryDirectory()에서 속성 오류가 발생합니다.

다음을 사용하여 임시 디렉터리를 만들려고 합니다.with tempfile.TemporaryDirectory() as directory:

임시파일을 가져왔습니다

프로그램을 실행하면 다음과 같은 오류가 발생합니다.

Traceback (most recent call last):
  File "batch.py", line 79, in <module>
    with tempfile.TemporaryDirectory() as directory:
AttributeError: 'module' object has no attribute 'TemporaryDirectory'

저는 파이썬 3.8을 실행 중입니다.

디버거를 사용하여 실행하면 프로그램이 성공적으로 실행되지만 디버거 없이 실행하면 이 오류가 발생합니다.

전체 코드:

with tempfile.TemporaryDirectory() as directory:
   for subdir, dirs, files in os.walk(rootdir):
      if subdir != rootdir and subdir != fDestination and subdir != meDir 
      and subdir != fileDestination and subdir != zdir:
         shutil.move(subdir, directory)

관련 정보