Packaged 0.5.3 Synology ipkg SplitHost bug (and workaround)

Get help with all aspects of SABnzbd
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
kbunny
Newbie
Newbie
Posts: 9
Joined: August 5th, 2008, 3:32 pm

Packaged 0.5.3 Synology ipkg SplitHost bug (and workaround)

Post by kbunny »

I'm posting this mostly to help other Synolgy users, because the error does not seem to lie in the Python code supplied by the SABNZBdplus project.

I upgraded my SABNZBdplus 0.5.0 to 0.5.3 on my Synology NAS today, by upgrading through the IPKG packages at http://ipkg.nslu2-linux.org/feeds/optwa ... e/Packages

When I started SABNZBdplus I was greeted with a nasty errormessage due to some errors in the package.
Something to do about Python not able to find a function SplitHost. Now, I have no experience with Python whatsoever, but I know a bit about programming.
The function SplitHost, according to the trace, was called in an added file "email.pyo" which appeared to be compiled or otherwise converted to binary. As there was no way to fix the file email.pyo itself, a workaround had to be found.

I managed to fix this by opening misc.py and copying the function split_host as SplitHost.

Retrying showed a new error:

Code: Select all

  File "/volume1/opt/share/SABnzbd/sabnzbd/emailer.py", line 218, in <module>
    from email.Message import Message
ImportError: No module named Message
Opening emailer.py showed this on the mentioned line:

Code: Select all

try:
    from email.message import Message
    from email.header import Header
    from email.encoders import encode_quopri
except:
    # Python 2.4 uses different names
    from email.Message import Message
    from email.Header import Header
    from email.Encoders import encode_quopri

RE_HEADER = re.compile(r'^([^:]+):(.*)')

def _prepare_message(txt):
    (snip)
Commenting the entire try/catch block (prepend #) fixed the import errors, but probably leaves some nasty emailing fatal error waiting in _prepare_message(). To have some chance of evading this, I modified _prepare_message() to immediately return True;

This fixed (or rather, quite sneakily worked around) the issue: SABNZBdplus 0.5.3 started normally.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Packaged 0.5.3 Synology ipkg SplitHost bug (and workaround)

Post by shypike »

Did you overwrite an old package with the new one?
Check if email.py isn't left behind and remove it.
We renamed email.py to emailer.py.
kbunny
Newbie
Newbie
Posts: 9
Joined: August 5th, 2008, 3:32 pm

Re: Packaged 0.5.3 Synology ipkg SplitHost bug (and workarou

Post by kbunny »

As my wife and I had a baby, you can imagine I have been quite busy elsewhere, I do however apologize for my rather delayed feedback.

Today I happened to upgrade to 0.5.6 (the 0.6.* range does not yet appear to be available prepackaged for my trusty Synology ds107). This of course prompted an overwrite of my workaround above and triggered the same problem as last year. I googled for the problem, and lo and behold, my own workaround popped up...
This time around however, the advice shypike posted mere hours after my post shed more light onto the issue. As I recall, I _did_ upgrade several times without removing old versions, so the suggestion is very reasonable. I did not find an email.py mentioned in the trace, but a precompiled email.pyo was available. Renaming this to email.pyo.old (better safe than sorry) fixed the issue and, exactly a year later, proved shypike right. I tip my hat to you.

Hopefully, when I'll upgrade to 0.6.5. this time next year, I'll pay attention to the upgrade instructions and clean out the old version. But just in case I start again without reading manuals and turning to Google after the fact: kbunny, rtfm.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Packaged 0.5.3 Synology ipkg SplitHost bug (and workarou

Post by shypike »

Good that it works now.
Congratulated with your baby!
Post Reply