I am not reassigning the open keyword yet still receive this error. Any suggestions or direction to fix my error?
with tempfile.mkdtemp() as test_dir:
print(test_dir)
AttributeError: __enter__
I am also new to python and I am having a hard time understanding these concepts.
with
statement. Have you triedtest_dir = tempfile.mkdtemp()
instead? – Octagonalwith
statement. There's no context to manage. The only reason I can think of for wanting a context manager here would be if you wanted the directory to be deleted on exit. – Polyphyletic