Closed flowstef closed 2 years ago
The answer is yes, I was missing something.
aiofiles.tempfile.NamedTemporaryFile()
returns AiofilesContextManager
, not tempfile.NamedTemporaryFile
so it needs to be further unpacked before it can be used:
context_manager = aiofiles.tempfile.NamedTemporaryFile()
tmpfile = context_manager._obj
I hope this helps others who run into the same problem.
A little bit late to the party, but I'm running through the same problem. However, the context_manager._obj
in my case is None
. :/
I rewrote some code using the synchronous
tempfile.NamedTemporaryFile
class from thisto this
I have to say I was surprised to see the following error:
Am I missing something? Is there a way to access the name of the temporary file?