#29091 closed Bug (fixed)
makemigrations crashes if a migration directory doesn't have an __init__.py
| Reported by: | Rafael Lott | Owned by: | nobody | 
|---|---|---|---|
| Component: | Migrations | Version: | 2.0 | 
| Severity: | Release blocker | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
I upgraded from Django 1.11 to Django 2.0.
When I ran 'makemigrations', I got this error.
   File "/home/webapp/.virtualenvs/odin/lib/python3.5/site-packages/django/db/migrations/questioner.py", line 51, in ask_initial
    filenames = os.listdir(migrations_module.__path__[0])
TypeError: '_NamespacePath' object does not support indexing
I manage to fix it by editing the file 'django/db/migrations/questioner.py' line 51 from:
filenames = os.listdir(migrations_module.__path__[0])
to
filenames = os.listdir(list(migrations_module.__path__)[0])
I don't know if this is the correct solution.
Change History (4)
comment:1 by , 8 years ago
| Severity: | Normal → Release blocker | 
|---|---|
| Summary: | Error on makemigrations: '_NamespacePath' object does not support indexing → makemigrations crashes if a migration directory doesn't have an __init__.py | 
| Triage Stage: | Unreviewed → Accepted | 
  Note:
 See   TracTickets
 for help on using tickets.
    
At least one of your migrations directories doesn't have an
__init__.pyfile. This is a regression in aadd3aeb2ba3153e35bd805c80c901f289a6f333 and a recurrence of #21868 (which was committed without a test).