[Django] #29091: Error on makemigrations: '_NamespacePath' object does not support indexing

5 views
Skip to first unread message

Django

unread,
Jan 30, 2018, 12:47:23 PM1/30/18
to django-...@googlegroups.com
#29091: Error on makemigrations: '_NamespacePath' object does not support indexing
---------------------------------------+------------------------
Reporter: Rafael Lott | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/29091>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 30, 2018, 1:38:33 PM1/30/18
to django-...@googlegroups.com
#29091: makemigrations crashes if a migration directory doesn't have an __init__.py
---------------------------------+------------------------------------

Reporter: Rafael Lott | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 2.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted
* severity: Normal => Release blocker


Comment:

At least one of your migrations directories doesn't have an `__init__.py`
file. This is a regression in aadd3aeb2ba3153e35bd805c80c901f289a6f333 and
a recurrence of #21868 (which was committed without a test).

--
Ticket URL: <https://code.djangoproject.com/ticket/29091#comment:1>

Django

unread,
Jan 30, 2018, 6:32:14 PM1/30/18
to django-...@googlegroups.com
#29091: makemigrations crashes if a migration directory doesn't have an __init__.py
---------------------------------+------------------------------------
Reporter: Rafael Lott | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 2.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/9640 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29091#comment:2>

Django

unread,
Jan 31, 2018, 9:58:03 AM1/31/18
to django-...@googlegroups.com
#29091: makemigrations crashes if a migration directory doesn't have an __init__.py
---------------------------------+------------------------------------
Reporter: Rafael Lott | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 2.0
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"0a37ea56d05208e31ed2f29fdffca65b6d92fa2e" 0a37ea56]:
{{{
#!CommitTicketReference repository=""
revision="0a37ea56d05208e31ed2f29fdffca65b6d92fa2e"
Fixed #29091 -- Fixed makemigrations crash if migrations directory doesn't
have __init__.py.

Regression in aadd3aeb2ba3153e35bd805c80c901f289a6f333.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29091#comment:3>

Django

unread,
Jan 31, 2018, 9:59:17 AM1/31/18
to django-...@googlegroups.com
#29091: makemigrations crashes if a migration directory doesn't have an __init__.py
---------------------------------+------------------------------------
Reporter: Rafael Lott | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 2.0

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"834843ca4fdc474eba4457dee3d99fb9c882ca65" 834843ca]:
{{{
#!CommitTicketReference repository=""
revision="834843ca4fdc474eba4457dee3d99fb9c882ca65"
[2.0.x] Fixed #29091 -- Fixed makemigrations crash if migrations directory
doesn't have __init__.py.

Regression in aadd3aeb2ba3153e35bd805c80c901f289a6f333.

Backport of 0a37ea56d05208e31ed2f29fdffca65b6d92fa2e from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29091#comment:4>

Reply all
Reply to author
Forward
0 new messages