Weird bug - directory with reitveld installation can not be named "codereview"

8 views
Skip to first unread message

anatoly techtonik

unread,
Dec 6, 2010, 12:53:38 PM12/6/10
to gae2django
Hi,

I've just wasted some hours on a very weird bug, but don't know where
to report it - to Django or here.
When rietveld example is installed in directory named
"codereview" (e.g. /home/user/codereview), the ./manage.py script
fails with the message:

Error: Could not import settings 'codereview.settings' (Is it on
sys.path? Does it have syntax errors?): No module named settings

If the directory is renamed to anything else (/var/rietveld of /home/
user/rietveld), everything goes fine. Environment is clean, files are
from a fresh checkout. The directory structure is below.

.
|-- codereview/
|-- django/
|-- gae2django/
|-- patches/
|-- rietveld_helper/
|-- static/
|-- templates/
|-- Makefile
|-- README
|-- TODO
|-- UPDATES
|-- __init__.py
|-- __init__.pyc
|-- dev.db
|-- manage.py*
|-- settings.py
|-- settings.pyc
`-- upload.py*


Is it a Django bug?
--
anatoly t.

Ilia Mirkin

unread,
Dec 6, 2010, 2:35:35 PM12/6/10
to gae2d...@googlegroups.com, anatoly techtonik
No insight as to what the problem is, but try running with python -v
-- that will print all if python's import decisions, and may shed
light unto the situation.

--
Ilia Mirkin
imi...@alum.mit.edu

Andi Albrecht

unread,
Dec 6, 2010, 2:41:34 PM12/6/10
to gae2d...@googlegroups.com, anatoly techtonik
I've seen this behavior before. It happens if the directory that contains manage.py has the same name as an application in this directory (aka Django project) *and* if there's an __init__.py. Django's import mechanism get's confused then when it tries to import "codereview".

The Django tutorial has a short note about avoiding built-in module names (http://docs.djangoproject.com/en/dev/intro/tutorial01/).

Andi

anatoly techtonik

unread,
Dec 7, 2010, 2:00:27 PM12/7/10
to Andi Albrecht, gae2d...@googlegroups.com
I see Stani reported the same issue -
http://code.djangoproject.com/ticket/5217 but seems like it was marked
as duplicate of a wrong ticket. The root of the problem is in
http://code.djangoproject.com/ticket/1908

Seems like this ticket should be revisited. I've wasted a lot of time
and somebody else will.
--
anatoly t.

Andi Albrecht

unread,
Dec 7, 2010, 11:47:49 PM12/7/10
to anatoly techtonik, gae2d...@googlegroups.com
On Tue, Dec 7, 2010 at 8:00 PM, anatoly techtonik <tech...@gmail.com> wrote:
I see Stani reported the same issue -
http://code.djangoproject.com/ticket/5217 but seems like it was marked
as duplicate of a wrong ticket. The root of the problem is in
http://code.djangoproject.com/ticket/1908

Thanks for pointing to this ticket! It's really a annoying issues where one can really waste a lot of time.
Reply all
Reply to author
Forward
0 new messages