Skip to content

default encoding problem despite utf-8 locale set #2

@mrkafk

Description

@mrkafk
(w2)d7 192.168.56.101 ~/w2/tmp/weightless-core/weightless/examples % ./httpserver.py
Traceback (most recent call last):
  File "./httpserver.py", line 26, in <module>
    from weightless.core import be
  File "/root/w2/local/lib/python2.7/site-packages/weightless/__init__.py", line 30, in <module>
    assert _getdefaultencoding() == 'utf-8', 'Please ensure that the default encoding is utf-8'
AssertionError: Please ensure that the default encoding is utf-8
(w2)d7 192.168.56.101 ~/w2/tmp/weightless-core/weightless/examples %

Fixed by adding the following to httpserver.py:

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

OS: Debian 7 / x64, installed default utf-8 locale.

(w2)d7 192.168.56.101 ~/w2/tmp/weightless-core/weightless/examples % locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions