Code

#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.

Attachments (0)

Change History (1)

comment:1 Changed 12 months ago by bmispelon

  • Cc bmispelon@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.