[RC6] Error in par2_repair function (Linux)

Questions and bug reports for Beta releases should be posted here.
Forum rules
Help us help you:
  • 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
thelists
Newbie
Newbie
Posts: 2
Joined: February 18th, 2010, 10:19 am

[RC6] Error in par2_repair function (Linux)

Post by thelists »

Just installed RC6.  Everything went smoothly during the installation process, and as a whole it works well unless one of the files is corrupted.  After it completes the download of of the relevant files + a couple PARs, I get the error below:

Code: Select all

::ERROR::[newsunpack:703] Error global name 'WindowsError' is not defined while running par2_repair
Per inpheaux's suggestion, I checked around line 703 for something similar to the exception handling in this forum post [http://forums.sabnzbd.org/index.php?topic=2144.0], but found nothing.

For completeness, here is the scrubbed version of the logs immediately before and after the error in question:

Code: Select all

2010-02-18 02:43:54,095::INFO::[postproc:244] Par2 check starting on FOO
2010-02-18 02:43:54,095::INFO::[postproc:251] Running repair on set FOO
2010-02-18 02:43:54,119::INFO::[newsunpack:679] Scanning "/my/path/to/nzb/incomplete/FOO
2010-02-18 02:43:54,181::ERROR::[newsunpack:703] Error global name 'WindowsError' is not defined while running par2_repair on set FOO
2010-02-18 02:43:54,181::INFO::[postproc:268] Par2 check finished on FOO
Any suggestions?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: [RC6] Error in par2_repair function (Linux)

Post by shypike »

Sloppy programming on our side for assuming that a Windows-only exception is defined on Unix.
However, the root-cause is that par2 doesn't run properly.
Do you have a working par2 installed?

If you are not afraid of a little hacking, find the file newsunpack.py among the SABnzbd files.
Go to line 36 where you'll see this block:

Code: Select all

if sabnzbd.WIN32:
    try:
        import win32api
        from win32con import SW_HIDE
        from win32process import STARTF_USESHOWWINDOW, IDLE_PRIORITY_CLASS
    except ImportError:
        pass
Append this after the pass statement:

Code: Select all

else:
    # Define dummy WindowsError for non-Windows
    class WindowsError(Exception):
        def __init__(self, value):
            self.parameter = value
        def __str__(self):
            return repr(self.parameter)
Next time an error occurs you'll see what's going on.

Please report back what your results are.
thelists
Newbie
Newbie
Posts: 2
Joined: February 18th, 2010, 10:19 am

Re: [RC6] Error in par2_repair function (Linux)

Post by thelists »

Added that code and restarted sab...

It's possible that I did a "make install" on par2 AFTER running sab the last time, but the par2 binaries were there when the errors occurred.  Could that have caused the problem?

Regardless, it's working beautifully now.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: [RC6] Error in par2_repair function (Linux)

Post by shypike »

The bad code is only hit when par2 encounters fatal errors.
Could be caused by what you did.

This will be fixed in 0.5.0Final.
Anyway: a good thing this error was detected.
Thanks for reporting it.
Post Reply