Opened 12 years ago

Closed 12 years ago

#20295 closed Uncategorized (worksforme)

from django.db import utils fails; import django.db.utils succeeds

Reported by: doublereedkurt Owned by: nobody
Component: Uncategorized Version: 1.5
Severity: Normal Keywords:
Cc: bmispelon@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Here's a simple reproduction for 1.5.1:

import os
os.environ[ 'DJANGO_SETTINGS_MODULE' ] = 'sys'
sys.SECRET_KEY = 'foo'
import django.db.utils #works! (as expected)
from django.db import utils #fails! wtf?

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

ImportError: cannot import name utils

Same problem occurs in 1.3.3.

This can manifest in a variety of ways:
File "/x/home16/eveljee/lib/python/site-packages/django/db/backends/sqlite3/base.py", line 14, in ?

from django.db import utils

TemplateSyntaxError: Caught ImportError while rendering: cannot import name utils

I have no theories as to what the underlying cause is; need someone more familiar with Django's internals.

Change History (1)

comment:1 by Baptiste Mispelon, 12 years ago

Cc: bmispelon@… added
Resolution: worksforme
Status: newclosed

Hi,

I can't reproduce the issue you're describing (I used your example with an added import sys at the top which I assume was missing).

The code you provided looks strange too: is sys really the name of your project? If so, that's not a very good name for a project since it clashes with a builtin python module.

I tried with django 1.5.1 and 1.3.3 as well as python 3 and none raise an ImportError.

I'm going to mark this as worksforme. Please re-open if you have some more information on how to reproduce this issue.

Thanks.

Note: See TracTickets for help on using tickets.
Back to Top