﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21862	Loading app fails with Python 3.3 resulting in: TypeError: '_NamespacePath' object does not support indexing	elbaschid	nobody	"I have just created a new Django project using the freshly released Django 1.7a1 with Python 3.3. I've create the project using django-admin. 

== Project Setup ==

{{{

    manage.py
    project/
       photo/
          models.py
       settings.py
       urls.py
       wsgi.py
}}}



I have created a custom app 'photo' that contains a single model 'Photo' and
nothing else. I've added the app in the settings using the old-style dotted
notation without an 'AppConfig'.

The INSTALLED_APPS in 'settings.py':


{{{
    INSTALLED_APPS = [
        ...
        'project.photo',
    ]
}}}


== Excpected Behaviour ==

The app 'project.photo' is loaded and './manage.py shell' or './manage.py runserver' are running fine.

== Actual Behaviour == 

When I am running './manage.py migrage' or even just './manage.py shell', I am
getting the following error:


{{{
Traceback (most recent call last):
  File ""./manage.py"", line 10, in <module>
    execute_from_command_line(sys.argv)
  File ""/home/elbaschid/.virtualenvs/disperser/lib/python3.3/site-packages/django/core/management/__init__.py"", line 427, in execute_from_command_line
    utility.execute()
  File ""/home/elbaschid/.virtualenvs/disperser/lib/python3.3/site-packages/django/core/management/__init__.py"", line 391, in execute
    django.setup()
  File ""/home/elbaschid/.virtualenvs/disperser/lib/python3.3/site-packages/django/__init__.py"", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File ""/home/elbaschid/.virtualenvs/disperser/lib/python3.3/site-packages/django/apps/registry.py"", line 84, in populate
    app_config = AppConfig.create(entry)
  File ""/home/elbaschid/.virtualenvs/disperser/lib/python3.3/site-packages/django/apps/base.py"", line 111, in create
    return cls(entry, module)
  File ""/home/elbaschid/.virtualenvs/disperser/lib/python3.3/site-packages/django/apps/base.py"", line 43, in __init__
    self.path = upath(app_module.__path__[0])
TypeError: '_NamespacePath' object does not support indexing

}}}

== Possible Solution == 

A similar problem has been reported on the pytest project with a fix that has
been accepted:

    https://bitbucket.org/hpk42/pytest/commits/dac4900b78f2

As the commit message there states ""Starting with Python 3.3, NamespacePath
passed to importlib hooks seem to have lost the ability to be accessed by
index."". This seems to be the same issue here."	Bug	closed	Python 3	1.7-alpha-1	Release blocker	duplicate			Accepted	0	0	0	0	0	0
