How to Solve NameError: name 'copyfile' is not defined -- shutil

Erorr: name 'copyfile' is not defined

NameError: name 'copyfile' is not defined

Solution: Import the 'copyfile' module

# Add the following line to the top of your code
from shutil import copyfile

 

For more information:
shutil copyfile