sentry icon indicating copy to clipboard operation
sentry copied to clipboard

Installation fails when locale is not set

Open majo83 opened this issue 13 years ago • 1 comments

During installation of sentry the command sentry --config=/etc/sentry.conf.py upgrade has to be issued.

This command failes, when locale is not set properly. Reason: In the file the following function gets executed during that command:


def get_system_username(): """ Try to determine the current system user's username.

:returns: The username as a unicode string, or an empty string if the
    username could not be determined.
"""
try:
    return getpass.getuser().decode(locale.getdefaultlocale()[1])
except (ImportError, KeyError, UnicodeDecodeError):
    # KeyError will be raised by os.getpwuid() (called by getuser())
    # if there is no corresponding entry in the /etc/passwd file
    # (a very restricted chroot environment, for example).
    # UnicodeDecodeError - preventive treatment for non-latin Windows.
    return u''

When locale ist not set properly, in the line return getpass.getuser().decode(locale.getdefaultlocale()[1]) the return value of locale.getdefaultlocale()[1] will be 'None'. The code can not handle that.

See also: http://docs.python.org/2/library/locale.html#locale.getdefaultlocale

Best regards, majo83

majo83 avatar Aug 16 '13 11:08 majo83

plz reopen if this is still an issue.

mattrobenolt avatar Feb 12 '16 07:02 mattrobenolt