开发者

django external script ImportError: No module named Utils

开发者 https://www.devze.com 2023-02-14 03:43 出处:网络
I search google and this forum and i found this solution sth=os.path.abspath(\'/home/artur/Desktop\') sys.path.append(sth)

I search google and this forum and i found this solution

sth=os.path.abspath('/home/artur/Desktop')
sys.path.append(sth)
os.environ['DJANGO_SETTINGS_MODULE'] = 'project_name.settings'

Every think seems to be ok even my editor provide support for import statement. And when i try to import my mode开发者_JS百科ls i get thiss

Traceback (most recent call last):
  File "email.py", line 12, in <module>
    from app_name.models import *
  File "app's models models.py", line 1, in <module>
    from django.db import models
  File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/db/models/__init__.py", line 5, in <module>
    from django.db.models.query import Q
  File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/db/models/query.py", line 9, in <module>
    from django.db.models.fields import DateField
  File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/db/models/fields/__init__.py", line 14, in <module>
    from django import forms
  File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/forms/__init__.py", line 14, in <module>
    from widgets import *
  File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/forms/widgets.py", line 9, in <module>
    from django.utils.html import escape, conditional_escape
  File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/utils/html.py", line 9, in <module>
    from django.utils.http import urlquote
  File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/utils/http.py", line 4, in <module>
    from email.Utils import formatdate
ImportError: No module named Utils

I try to google around this but can't find nothing to help solve this(found some similar way to add django settings file but all failed with the same error).My OS is Debian testing and python 2.6.6. Thanks for any help or sugestions.


email.Utils is a python standard library module. Do you have a module called email that's conflicting with it?

Go into a shell and type in

import email
print email.__file__ # where is this "email" module? 
# make sure it's not one of yours...
0

精彩评论

暂无评论...
验证码 换一张
取 消