Page 1 of 1

Python Error after Upgrade

Posted: March 16th, 2012, 3:59 pm
by ocin24
Hey guys, I have been poking around the forum all morning trying to find an answer to this problem, but, alas, have found none... :'(

So here's my situation: I have a box running fBSD which I have been using for a while to host media, etc. When I recently ran "portupgrade -a" I installed the most recent release of SABnzbd. Now I am having issues with getting it up and running.

I have tried running a

Code: Select all

# make deinstall clean
# make reinstall clean
along with renaming the .ini and other little tricks I've found helped before.

This time, however, I am getting an error:

Code: Select all

 root@server [sabnzbd] $/usr/local/etc/rc.d/sabnzbd start
The Python module Cheetah is required
Starting sabnzbd.
 root@server [sabnzbd] $
[BTW: netstat shows that the ports aren't listening after this step. I can get them to do so by running SABnzbd.py manually with python.]

So I have narrowed this down to a bit of code in SABnzbd.py:

Code: Select all

try:
    import Cheetah
    if Cheetah.Version[0] != '2':
        raise ValueError
except ValueError:
    print "Sorry, requires Python module Cheetah 2.0rc7 or higher."
    sys.exit(1)
except:
    print "The Python module Cheetah is required"
    sys.exit(1)
"So now you know what your issue is, idiot!"

You'd think so, but when I try to do these commands manually:

Code: Select all

 root@server [sabnzbd] $python
Python 2.7.2 (default, Mar 16 2012, 08:47:13)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
>>> import Cheetah
>>> Cheetah.Version[0]
'2'
>>>
Everything works fine!I'm assuming that something is messing up the works and making that script throw the exception that exit()s the program, but I have no idea what would cause this!

Could somebody please give me some guidance on this? It's really killing me that I have no idea where to turn. :-[

EDIT: Also, while waiting for some help, I tried to comment out the try/except portion of the program, and that did absolutely nothing for me. I wonder if somewhere a different version of the file is being called... One that uses a different version of python, maybe? Just speculation. :-)

Also, I was sure to back up the SABnzbd.py file so I wouldn't mess anything up, in case you're wondering. :)

UPDATE: Frost in the IRC channel pointed me to the init (rc.d) script and I realized that the problem occurred *only* when python (same version - 2.7) was run as the _sabnzbd user. I am currently trying to figure out why in the world this user wouldn't have access to the module though others do... Any pointers would be greatly appreciated.

Re: Python Error after Upgrade

Posted: March 16th, 2012, 8:26 pm
by ocin24
UPDATE 2 (my first post was getting a bit lengthy):

So I found that by hacking around in SABnzbd.py I was able to use sys.path.append() to get the scripts to import correctly. But I'm afraid this whole issue is indicative of a larger problem since, even after all the modules apparently loaded, there are still major issues. I have un/reinstalled again and now I'm back to square one.

Would it make sense to reinstall python or something like that?

Thanks for your insight

Re: Python Error after Upgrade

Posted: March 17th, 2012, 2:24 am
by shypike
The error message about Cheetah means that a non-standard module was not
installed (or could not be found).
Usually non-standard modules are stored in a different location than
standard modules and may require setting of the environment variable PYTHONPATH.

Re: Python Error after Upgrade

Posted: March 18th, 2012, 2:18 pm
by ocin24
Thanks for the tip Shypike, I ended up getting it working, but it's still not quite right yet. I'm still not sure what happened, but I think I'll be able to get it running cleanly again. :)

Re: Python Error after Upgrade

Posted: March 18th, 2012, 3:40 pm
by ocin24
It looks like there was some problem with my configuration, although I can't for the life of me figure out how it happened. Just in case anyone sees this and is wondering what I did:

I checked my /usr/local/lib/python2.7/site-packages/ directory and found that the *.pth files (which include paths to modules) were set with improper permissions. I Chmod'd them to 644 and my problem was solved! Then there was a problem with the par2/unzip/unrar binaries not being found, and I assume the problem is similar. I couldn't find where the .pth files were (if they even still existed), so I just edited the newsunpack.py file to add direct paths (instead of find_on_path() ).

Code: Select all

        if not sabnzbd.newsunpack.PAR2_COMMAND:
            sabnzbd.newsunpack.PAR2_COMMAND = '/usr/local/bin/par2'
        if not sabnzbd.newsunpack.RAR_COMMAND:
            sabnzbd.newsunpack.RAR_COMMAND = '/usr/local/bin/unrar'
        sabnzbd.newsunpack.NICE_COMMAND = '/usr/bin/nice'
        sabnzbd.newsunpack.IONICE_COMMAND = find_on_path('ionice')
        sabnzbd.newsunpack.ZIP_COMMAND = '/usr/local/bin/unzip'
I'm glad to have my favorite software back up and running!

Re: Python Error after Upgrade

Posted: September 28th, 2012, 7:44 am
by dedas
i'm having the same problem since an portupgrade this moring..

shypike said
"The error message about Cheetah means that a non-standard module was not
installed (or could not be found).
Usually non-standard modules are stored in a different location than
standard modules and may require setting of the environment variable PYTHONPATH."

how do i check this?

Re: Python Error after Upgrade

Posted: September 28th, 2012, 9:11 am
by shypike
dedas wrote:i'm having the same problem since an portupgrade this moring..
That's not much information to go on.
Platform?
"portupgrade" ??

Re: Python Error after Upgrade

Posted: September 28th, 2012, 1:31 pm
by dedas
got it fixed.. installed a older stable version of cheetah and its working now :D