Forums

Debugging problem: unhandled Exception

I got this in my error file Seems things go wrong here: File "/home/davidzhao800/uTunes/store/forms.py", line 16, in init super(SearchForm,self).init(args,*kwargs)

But I do not know how to fix it and I have Google it, cannot get answer.

Traceback (most recent call last):
2015-04-21 15:27:29,360 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/core/handlers/base.py", line 132, in get_response
2015-04-21 15:27:29,361 :    response = wrapped_callback(request, *callback_args, **callback_kwargs)
2015-04-21 15:27:29,361 :  File "/home/davidzhao800/uTunes/store/views.py", line 18, in indexView
2015-04-21 15:27:29,363 :    search_form = SearchForm()
2015-04-21 15:27:29,363 :  File "/home/davidzhao800/uTunes/store/forms.py", line 16, in __init__
2015-04-21 15:27:29,364 :    super(SearchForm,self).__init__(*args,**kwargs)
2015-04-21 15:27:29,365 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/forms/forms.py", line 129, in __init__
2015-04-21 15:27:29,366 :    self.label_suffix = label_suffix if label_suffix is not None else _(':')
2015-04-21 15:27:29,366 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/utils/translation/__init__.py", line 84, in ugettext
2015-04-21 15:27:29,367 :    return _trans.ugettext(message)
2015-04-21 15:27:29,368 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/utils/translation/trans_real.py", line 317, in gettext
2015-04-21 15:27:29,369 :    return do_translate(message, 'gettext')
2015-04-21 15:27:29,370 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/utils/translation/trans_real.py", line 300, in do_translate
2015-04-21 15:27:29,370 :    _default = _default or translation(settings.LANGUAGE_CODE)
2015-04-21 15:27:29,370 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/utils/translation/trans_real.py", line 206, in translation
2015-04-21 15:27:29,371 :    _translations[language] = DjangoTranslation(language)
2015-04-21 15:27:29,371 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/utils/translation/trans_real.py", line 115, in __init__
2015-04-21 15:27:29,372 :    self._init_translation_catalog()
2015-04-21 15:27:29,372 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/utils/translation/trans_real.py", line 153, in _init_translation_catalog
2015-04-21 15:27:29,373 :    translation = self._new_gnu_trans(localedir, use_null_fallback)
2015-04-21 15:27:29,373 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/utils/translation/trans_real.py", line 136, in _new_gnu_trans
2015-04-21 15:27:29,373 :    fallback=use_null_fallback)
2015-04-21 15:27:29,374 :  File "/usr/lib/python3.4/gettext.py", line 416, in translation
2015-04-21 15:27:29,374 :    raise OSError(ENOENT, 'No translation file found for domain', domain)
2015-04-21 15:27:29,374 :FileNotFoundError: [Errno 2] No translation file found for domain: 'django'
2015-04-21 15:27:29,374 :
2015-04-21 15:27:29,374 :During handling of the above exception, another exception occurred:
2015-04-21 15:27:29,374 :
2015-04-21 15:27:29,374 :Traceback (most recent call last):
2015-04-21 15:27:29,374 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/template/defaultfilters.py", line 771, in date
2015-04-21 15:27:29,376 :    return formats.date_format(value, arg)
2015-04-21 15:27:29,376 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/utils/formats.py", line 136, in date_format
2015-04-21 15:27:29,378 :    return dateformat.format(value, get_format(format or 'DATE_FORMAT', use_l10n=use_l10n))
2015-04-21 15:27:29,378 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/utils/formats.py", line 108, in get_format
2015-04-21 15:27:29,378 :    return getattr(settings, format_type)
2015-04-21 15:27:29,378 :  File "/home/davidzhao800/.virtualenvs/uTunes/lib/python3.4/site-packages/django/conf/__init__.py", line 49, in __getattr__
2015-04-21 15:27:29,380 :    return getattr(self._wrapped, name)
2015-04-21 15:27:29,380 :AttributeError: 'Settings' object has no attribute 'r'

It looks like you're using the Django translation facility (it's the call to _(":") at line 129 of forms.py that's using it), but you don't have a translation file. Have a look at this for your version of Django to learn how to create translation files.

Thanks glenn, I found where is wrong. I had changed the LANGUAGE CODE in settings.py to "utf-16", And I changed to "en-us" It worked perfectly. Thank you!