Howdy,
In python 3.3 you no longer need __init__.py in directories to be
interpreted as package namespaces. In my source I have the following tree
src
/apps
/index
/mapping
I removed the __init__.py files as I should be able to, but imports broke.
Specifically:
/opt/python3.3.1/lib/python3.3/site-packages/django/utils/translation/trans_real.py(155)_fetch()
154 app = import_module(appname)
2-> 155 apppath =
os.path.join(os.path.dirname(upath(app.__file__)), 'locale')
notice the app.__file__. In python 3.3 modules are not required to have a
__file__ attribute.
So in particular, I was not able to execute
python3.3 manage.py shell because of the cryptic
*** AttributeError: 'module' object has no attribute '__file__'
which I traced to this line in the Django source.
I don't know if it appears anywhere else, but module.__file__ is no longer
robust in python 3.3.
The poor man's fix is to put the __init__.py's back in.
src
/apps
/index
__init__.py
/mapping
__init__.py
works just fine, but shouldn't be required.
This is on RHEL5.8, but I doubt that matters.
thanks,
Danny
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment