Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'Nonetype' object has no attribute '_info'

Tags:

python

django

I am working on a Django project and this error arises when I try to run any management commands such as: python manage.py validate --settings ord.settings.development, python manage.py syncdb --settings ord.settings.development. The project uses Django 1.5 The error is: AttributeError: 'Nonetype' object has no attribute '_info'. No other output is given.

The project base settings file is: https://gist.github.com/anonymous/5c0fede63b2724d7880b

The development settings: https://gist.github.com/anonymous/f60b90dcf573b0a7b920

I have replaced sensitive settings with x

Any idea what could be wrong?

Some extra info, when i comment out the LANGUAGE_CODE settings, some commands like validate, runserver, shell run fine but syncdb and migrate fail with error: DatabaseError: current transaction is aborted, commands ignored until end of transaction block

Traceback: https://gist.github.com/anonymous/bc3364ae5ba511566871

like image 752
lenny Avatar asked Aug 04 '15 18:08

lenny


People also ask

How do I fix NoneType has no attribute?

The Python "AttributeError: 'NoneType' object has no attribute 'items'" occurs when we try to call the items() method on a None value, e.g. assignment from function that doesn't return anything. To solve the error, make sure to only call items() on dict objects.

What does NoneType object has no attribute mean?

You are getting AttributeError: 'NoneType' object has no attribute 'something' because NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None. It means that an assignment or function call up above failed or returned an unexpected result.

How do I fix NoneType errors in Python?

The error “TypeError: 'NoneType' object is not iterable” occurs when you try to iterate over a NoneType object. Objects like list, tuple, and string are iterables, but not None. To solve this error, ensure you assign any values you want to iterate over to an iterable object.

What is AttributeError NoneType?

The "AttributeError: 'NoneType' object has no attribute 'get'" occurs for multiple reasons: Having a function that doesn't return anything (returns None implicitly). Explicitly setting a variable to None . Assigning a variable to the result of calling a built-in function that doesn't return anything.


2 Answers

Had the same issue,

Please follow the steps:

  1. go to django/utils/translation/trans_real.py
  2. search for res = _translation(globalpath)
  3. Add the following:

    if res is None:
        return gettext_module.NullTranslations()
    

source: https://code.djangoproject.com/ticket/18192

like image 133
mmrs151 Avatar answered Oct 04 '22 21:10

mmrs151


Had the same problem with a new installation on ubuntu 14.04. After lots of digging - thought I should share my finding: We are using django 1.5 and had the same error. It appears that the django installation was missing the folder django/conf/locale/en/LC_MESSAGES

Solution was to install latest version "pip install django==1.5.12"

like image 31
Gilad E. Avatar answered Oct 04 '22 23:10

Gilad E.