Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'utf_8_decode' #16

Open
mikebryant opened this issue May 16, 2014 · 0 comments
Open

Comments

@mikebryant
Copy link
Contributor

Environment:
Virtualenv, Python 2.7.3, Ubuntu precise

django-setuptest is included in the tests_require parameter.

If django-setuptest is not installed, the setup.py test command breaks:

(.virtualenv)jenkins@xxx:/home/xxx/slave/workspace/xxx/xxx$ python setup.py test                                                                                                                                  
running test
Checking .pth file support in .
/home/xxx/slave/workspace/xxx/xxx/.virtualenv/bin/python -E -c pass
Searching for django-setuptest
Reading http://pypi.xxx/djangopypi/simple/django-setuptest/
Best match: django-setuptest 0.1.4
Downloading http://pypi.xxx/media/dists/django-setuptest-0.1.4.tar.gz#md5=6a02d4dfa770581024c83f3f29512952
Processing django-setuptest-0.1.4.tar.gz
Running django-setuptest-0.1.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-457KZc/django-setuptest-0.1.4/egg-dist-tmp-JhF1ca

Installed /tmp/xxx/xxx/django_setuptest-0.1.4-py2.7.egg
running egg_info
writing requirements to xxx.egg-info/requires.txt
writing xxx.egg-info/PKG-INFO
writing top-level names to xxx.egg-info/top_level.txt
writing dependency_links to xxx.egg-info/dependency_links.txt
reading manifest file 'xxx.egg-info/SOURCES.txt'
writing manifest file 'xxx.egg-info/SOURCES.txt'
running build_ext
Creating test database for alias 'default'...
Traceback (most recent call last):
  File "setup.py", line 18, in <module>
    tests_require        = ['django-autoconfig', 'django-setuptest'],
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/test.py", line 137, in run
    self.with_project_on_sys_path(self.run_tests)
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/test.py", line 117, in with_project_on_sys_path
    func()
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/test.py", line 146, in run_tests
    testLoader = loader_class()
  File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/usr/lib/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python2.7/unittest/loader.py", line 113, in loadTestsFromName
    test = obj()
  File "/tmp/xxx/xxx/django_setuptest-0.1.4-py2.7.egg/setuptest/setuptest.py", line 56, in __init__
    self.old_config = self.test_runner.setup_databases()
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/test/simple.py", line 316, in setup_databases
    self.verbosity, autoclobber=not self.interactive)
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/db/backends/creation.py", line 293, in create_test_db
    load_initial_data=False)
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 161, in call_command
    return klass.execute(*args, **defaults)
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 250, in execute
    translation.activate('en-us')
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 90, in activate
    return _trans.activate(language)
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 183, in activate
    _active.value = translation(language)
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 172, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 133, in _fetch
    res = _translation(globalpath)
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 127, in _translation
    t = gettext_module.translation('django', path, [loc], DjangoTranslation)
  File "/usr/lib/python2.7/gettext.py", line 493, in translation
    t = _translations.setdefault(key, class_(fp))
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 75, in __init__
    gettext_module.GNUTranslations.__init__(self, *args, **kw)
  File "/usr/lib/python2.7/gettext.py", line 180, in __init__
    self._parse(fp)
  File "/usr/lib/python2.7/gettext.py", line 337, in _parse
    tmsg = unicode(tmsg, self._charset)
  File "/home/xxx/slave/workspace/xxx/xxx/.virtualenv/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
AttributeError: 'NoneType' object has no attribute 'utf_8_decode'

Running it a second time works.
Or, If django-setuptest is installed manually with pip first, that also works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant