It seems this line
hiddenimports = [django_dottedstring_imports(root_dir)
for root_dir in django_root_dirs]
in hooks-django.py can call django_dottedstring_imports with an empty root_dir, which causes the os.path.basename to crash pyinstaller.
Since I was not using django, I just replaced the above line with
hiddenimports = [None]
and it was able to generate my EXE file. Perhaps there is a better way to fix this bug?
Thanks,
--Ram.