How to solve NameError: name 'admin'

Import codecs

To import codecs, Add the following line to the top of your code.

import codecs

 

For more information about codecs:
Python codecs