Page 1 of 1

HELP! SABnzbd isolated install won't startup....

Posted: February 20th, 2012, 2:49 am
by madgabz
Hi,
I've got an old standalone - or isolated - install of SABnzbd 0.6.5 running perfectly smooth! But, as newzbin have changed url, i want to upgrade to the latest version, as to fix the url-probs, plus ofc get the usual updates/new features.
I'm on a full freenas-system (0.7.2 Sabanda (revision 8191), FreeBSD 7.3-RELEASE-p7 (revision 199506) i386full), but am NOT a *nix-savvy user! I know my console, but thats about it :)
I've been following these steps from the freenas forums for the initial install: HOWTO: SABnzbd, SickBeard & CouchPotato totally isolated

Now, following those same steps to install newest version in a SEPARATE directory makes the new SABnzbd start up with following errors:

Code: Select all

Traceback (most recent call last):
  File "/mnt/data2/sabapps/temp/SABnzbd/SABnzbd.py", line 65, in <module>
    import sabnzbd
  File "/mnt/data2/sabapps/temp/SABnzbd/sabnzbd/__init__.py", line 85, in <module>
    import sabnzbd.api
  File "/mnt/data2/sabapps/temp/SABnzbd/sabnzbd/api.py", line 29, in <module>
    locale.setlocale(locale.LC_ALL, "")
  File "/usr/local/lib/python2.7/locale.py", line 531, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
I'm using the following bash-script to start up SABnzbd:

Code: Select all

#!/usr/local/bin/bash
#sabstart.sh
PATH=$PATH:/mnt/data2/sabapps/temp/bin
PYTHONPATH="/mnt/data2/sabapps/temp/lib/python2.7/site-packages" /usr/local/bin/python /mnt/data2/sabapps/temp/SABnzbd/SABnzbd.py -d -f /mnt/data2/sabapps/temp/sabconfig/sabnzbd.ini -s 0.0.0.0:8085
/mnt/data2/sabapps/temp/bin contains:

Code: Select all

drwxr-xr-x  2 root  wheel    15B Feb 17 22:25 .
drwxr-xr-x  7 root  wheel    14B Feb 17 22:34 ..
-rwxr-xr-x  1 root  wheel   184B Feb  7 23:22 cheetah
-rwxr-xr-x  1 root  wheel   200B Feb  7 23:22 cheetah-analyze
-rwxr-xr-x  1 root  wheel   200B Feb  7 23:22 cheetah-compile
-r-xr-xr-x  1 root  wheel    22K Dec  3 00:59 funzip
-r-xr-xr-x  4 root  wheel   224K Dec  3 01:14 par2
-r-xr-xr-x  4 root  wheel   224K Dec  3 01:14 par2create
-r-xr-xr-x  4 root  wheel   224K Dec  3 01:14 par2repair
-r-xr-xr-x  4 root  wheel   224K Dec  3 01:14 par2verify
-r-xr-xr-x  1 root  wheel   190K Jan 30 19:24 unrar
-r-xr-xr-x  1 root  wheel   143K Dec  3 00:59 unzip
-r-xr-xr-x  1 root  wheel    63K Dec  3 00:59 unzipsfx
-r-xr-xr-x  1 root  wheel   2.9K Dec  3 00:59 zipgrep
lrwxr-xr-x  1 root  wheel     5B Dec  3 00:59 zipinfo -> unzip
Python version is: 2.7.2

This works perfectly for old version, new version is NoGo :/
I've got couchpotato, Sickbeard and Headphones running perfectly alongside, using same startup-procedure!

Please, help me get this running, or just some general pointers if I need to post this on the FreeNAS forums instead...

Thank You for Your time,
MadGabZ

Re: HELP! SABnzbd isolated install won't startup....

Posted: February 20th, 2012, 5:33 pm
by shypike
Your Python installation is incomplete, it misses proper localization support.
A work-around is to patch the file sabnzbd/api.py
Change the following lines as is shown:
line 28/29:

Code: Select all

#import locale 
#locale.setlocale(locale.LC_ALL, "")
line 1042/1043:

Code: Select all

            slot['mb_fmt'] = '%d' % int(mb)
            slot['mbdone_fmt'] = '%d' % int(mb-mbleft)
I'll see if a work-around for misbehaving Python ports can be added in the next release.

Re: HELP! SABnzbd isolated install won't startup....

Posted: February 20th, 2012, 6:07 pm
by shypike
You can try an alternative patch.
I would appreciate some feedback on this one.

Same file sabnzbd/api.py

Line 28/29 is now:

Code: Select all

    import locale
    locale.setlocale(locale.LC_ALL, "")
Replace these by:

Code: Select all

    import locale
    try:
        locale.setlocale(locale.LC_ALL, "")
    except:
        pass

Re: HELP! SABnzbd isolated install won't startup....

Posted: February 21st, 2012, 3:20 am
by madgabz
Thanks a lot, shypike, I'll try both solutions and report on my findings!

Re: HELP! SABnzbd isolated install won't startup....

Posted: February 21st, 2012, 3:35 am
by madgabz
OK, Both approaches works a treat!!! SABnzbd starts up and immediately starts fetching and downloading bookmarks from Newzbin2.es
Thank You for 'fixing' my poor python-install! :) Really, I should try and fix python, but its such a hassle on this dumbed-down-Freenas installation. I'll look into it, and probably should post something in the Freenas.org forums/Python-port-maintainers!
Now, what functionality/behaviour should i expect to be broken if LOCALE is disabled? Only the internal LOCALE-schemes, right?

Re: HELP! SABnzbd isolated install won't startup....

Posted: February 21st, 2012, 4:35 am
by shypike
It's only that 20000.00 will be shown as 20000.00 instead of 20,000.00 or 20.000,00
in some places in the Plush skin.
If both solutions work, I'll implement the second one in the next release.
(the one with try/except).

Re: HELP! SABnzbd isolated install won't startup....

Posted: February 21st, 2012, 3:28 pm
by madgabz
Ah! No Biggie, then!
Surfing around SABnzbds webpage reveals no problems AFAIK! using theme: Plush Gold here, and danish translation, all is well! :)