This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' #4698
Labels
You can continue the conversation there. Go to discussion →
What happened?
When running
$ python manage.py migrate
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
What should've happened instead?
migrations should be run properly
Additional details
I think this error is because its expecting python 3.11 but i wanted to use python 3.9 and it does not support use of | symbol
Error trace
(photoapp) (base) sandeep@sandeeps-MacBook-Pro photoapp % python manage.py migrate
Traceback (most recent call last):
File "/Users/sandeep/work/photoapp/photoapp/manage.py", line 31, in
execute_from_command_line(sys.argv)
File "/Users/sandeep/.venvs/photoapp/lib/python3.9/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/Users/sandeep/.venvs/photoapp/lib/python3.9/site-packages/django/core/management/init.py", line 416, in execute
django.setup()
File "/Users/sandeep/.venvs/photoapp/lib/python3.9/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/sandeep/.venvs/photoapp/lib/python3.9/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/Users/sandeep/.venvs/photoapp/lib/python3.9/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "/Users/sandeep/.pyenv/versions/3.9.18/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/Users/sandeep/work/photoapp/photoapp/photoapp/users/models.py", line 6, in
from photoapp.users.managers import UserManager
File "/Users/sandeep/work/photoapp/photoapp/photoapp/users/managers.py", line 5, in
class UserManager(DjangoUserManager):
File "/Users/sandeep/work/photoapp/photoapp/photoapp/users/managers.py", line 8, in UserManager
def _create_user(self, email: str, password: str | None, **extra_fields):
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
The text was updated successfully, but these errors were encountered: