Skip to content

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' #4699

Answered by luzfcb
sandeepeecs asked this question in Q&A
Discussion options

You must be logged in to vote

@sandeepeecs From the logs and your comment, you are using python3.9. However the current version of cookiecutter-django expects python3.11.

To fix the problem on the users/managers.py, simply add from __future__ import annotations at the top (first line) of the users/managers.py file and any other python file that makes use of the | operator on type hints.

Observing this will not prevent/fix if the same error from happening due to some Python dependency making use of functionality that only exists in Python3.10+. Ideally, it would be best if you used Python3.11 or higher.

The | operator for type hint was included in Python3.10+ by PEP 604

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by luzfcb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants
Converted from issue

This discussion was converted from issue #4698 on November 27, 2023 20:28.