Search code examples
pythondjangopython-3.xdatabase-migrationdjango-migrations

makemigration causing error "TypeError: expected str, bytes or os.PathLike object, not NoneType"


Running makemigration command inside docker container caused this error, can anyone please help me figure out what the problem is ?

python3.7 manage.py makemigrations
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/reportlab/lib/utils.py", line 667, in open_for_read
    return open_for_read_by_name(name,mode)
  File "/usr/local/lib/python3.7/site-packages/reportlab/lib/utils.py", line 611, in open_for_read_by_name
    return open(name,mode)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Solution

  • Please check absence of your_app/migrations/__init__.py

    If it's not present django could be throw this exception and the solition in this case

    -> add __init__.py the execute python manage.py makemigrations again