How to Solve NameError: name 'mkdtemp' is not defined -- tempfile

Solution: Import the 'mkdtemp' module

# Add the following line to the top of your code
from tempfile import mkdtemp

 

For more information:
tempfile mkdtemp