[Solved] Error with locale setting

Support for the Debian/Ubuntu package, created by JCFP.
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
frntman
Newbie
Newbie
Posts: 2
Joined: June 18th, 2014, 6:28 pm

[Solved] Error with locale setting

Post by frntman »

Hello,

I am attempting to create a package to install sabnzbdplus on a NAS and what the issue is while testing the installed package which is referencing a "unsupported locale setting". The output looks like this:

Code: Select all

[=======>   ] 95%[WARNING] Command "chroot /opt/devine/showcase-98d933c /etc/rc.local start" exited with code 1 and the following output: Starting SABnzbd+ binary newsgrabber: failed!

Traceback (most recent call last):
  File "/usr/bin/sabnzbdplus", line 66, in <module>
    import sabnzbd
  File "/usr/share/sabnzbdplus/sabnzbd/__init__.py", line 85, in <module>
    import sabnzbd.api
  File "/usr/share/sabnzbdplus/sabnzbd/api.py", line 29, in <module>
    locale.setlocale(locale.LC_ALL, "")
  File "/usr/lib/python2.7/locale.py", line 547, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

[INFO] Progress: [================================================================>] 100%
[ERROR] Error starting the package com.mycompany.showcase: Error while launching 'rc.local'
Only thing I find referencing this is to install languages

Code: Select all

sudo apt-get install language-pack-en language-pack-en-base manpages
results in:

Code: Select all

E: Unable to locate package language-pack-en
I am not even sure if the presents of the language pack is really even the issue because when I check I see

Code: Select all

root@devine-VirtualBox:/# locale -a
C
C.UTF-8
POSIX
as well as

Code: Select all

root@devine-VirtualBox:/# locale 
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C


any help with understanding this greatly appreciated

thanks
Last edited by frntman on June 19th, 2014, 5:04 pm, edited 1 time in total.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Error with locale setting

Post by shypike »

The package you're trying to install is obsolete.
This problem was fixed two year ago.

If nothing newer is available, you can try to patch the source code.
Just remove line 29 in file /usr/share/sabnzbdplus/sabnzbd/api.py

However, we do not support older versions.
frntman
Newbie
Newbie
Posts: 2
Joined: June 18th, 2014, 6:28 pm

Re: [Solved] Error with locale setting

Post by frntman »

Thank you for the reply. I removed the line and was able to repackage the crusty old one. I now will start again with a newer one since this apparently is out of date. I did use apt-get sabnzbdplus to install it. I'm new to linux and kinda confused how I winded up with such a out of date install.

thanks again
User avatar
jcfp
Release Testers
Release Testers
Posts: 1022
Joined: February 7th, 2008, 12:45 pm

Re: [Solved] Error with locale setting

Post by jcfp »

With Debian stable, focus is on stability. Due to their lengthy test fase alone, software is often no longer at the latest version by the time the distribution is officially released. In most cases, that's not a problem; sometimes it is and you'll get to meet a developer telling you they fixed your bug years ago. ;D

Various ways to update sab on Debian are listed at http://forums.sabnzbd.org/viewtopic.php?f=16&t=9844 btw
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: [Solved] Error with locale setting

Post by shypike »

jcfp wrote:With Debian stable, focus is on stability.
I wonder about its effectiveness.
That they don't carry the latest SABnzbd, I understand.
But frntman's problem was caused by a serious bug in Debian's Python implementation.
SABnzbd needed a work-around for that.
User avatar
jcfp
Release Testers
Release Testers
Posts: 1022
Joined: February 7th, 2008, 12:45 pm

Re: [Solved] Error with locale setting

Post by jcfp »

Did some more checks... The "locale.Error: unsupported locale setting" seems to be triggered here because some of the LC_* values are based on LANG. Locales listed as available in 'locale -a' works fine, anything else throws an error:

Code: Select all

$ locale -a
C
C.UTF-8
en_US.utf8
nl_NL.utf8
POSIX

$ echo $LANG
en_US.UTF-8

$ LANG=nl_BE.UTF-8 python -c 'import locale; locale.setlocale(locale.LC_ALL, "")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/locale.py", line 579, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
My knowledge of the specifics of the interaction between locale and python are insufficient to judge whether that makes sense.

In case of frntman, LANG is set to en_US.UTF-8 (for his login shell anyway) but that locale is not present on his system according to the posted output of 'locale -a', which could explain the error. That is assuming the init script environment is similar - which may or may not be the case given that the service seems to run in some kind of chroot triggered from rc.local. A possible workaround on those very old versions could be simply defining LANG to something workable before running sab, for example by adding "export LANG=whatever" to /etc/default/sabnzbdplus. Anyway, long worked around in sab so unlikely to ever surface again.
Post Reply