%EC%97%90%EC%84%9C%20%EC%86%8D%EC%84%B1%20%EC%98%A4%EB%A5%98%EA%B0%80%20%EB%B0%9C%EC%83%9D%ED%95%A9%EB%8B%88%EB%8B%A4..png)
다음을 사용하여 임시 디렉터리를 만들려고 합니다.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)