sabnzbd / sabnzbd

SABnzbd - The automated Usenet download tool
http://sabnzbd.org
Other
2.29k stars 339 forks source link

missing 7z binary results in Traceback #1305

Closed sanderjo closed 5 years ago

sanderjo commented 5 years ago

As discussed here: https://forums.sabnzbd.org/viewtopic.php?f=3&t=24254#p119180

If 7z / 7zip / 7za binary is missing, and SAB has a 7z download, a Traceback will occur.

EDIT: SAB does show a (too friendly?) warning on the Config page:

image and a messag in sabnzbd.log: 7za binary... NOT found!

I solved the traceback in seven_extract_core() with

    if not SEVEN_COMMAND:
        return 1, [], T('SJ: No 7ZIP binary found, cannot unpack "%s"') % os.path.basename(sevenset)

Result:

image

@Safihre

2019-07-06 22:01:26,931::INFO::[newsunpack:265] 7za starting on /home/sander/Downloads/incomplete/reftestnzb-7z-instead-of-rar-ea5b7e8fcddd
2019-07-06 22:01:26,932::INFO::[newsunpack:947] Starting extract on 7zip set/file: /home/sander/Downloads/incomplete/reftestnzb-7z-instead-of-rar-ea5b7e8fcddd/blabla.7z 
2019-07-06 22:01:26,933::ERROR::[postproc:537] Post Processing Failed for reftestnzb-7z-instead-of-rar-ea5b7e8fcddd (see logfile)
2019-07-06 22:01:26,935::INFO::[postproc:538] Traceback: 
Traceback (most recent call last):
  File "/usr/share/sabnzbdplus/sabnzbd/postproc.py", line 382, in process_job
    unpack_error, newfiles = unpack_magic(nzo, workdir, tmp_workdir_complete, flag_delete, one_folder, (), (), (), (), ())
  File "/usr/share/sabnzbdplus/sabnzbd/newsunpack.py", line 266, in unpack_magic
    error, newf = unseven(nzo, workdir, workdir_complete, dele, one_folder, new_sevens)
  File "/usr/share/sabnzbdplus/sabnzbd/newsunpack.py", line 955, in unseven
    res, new_files_set, msg = seven_extract(nzo, seven, extensions, extraction_path, one_folder, delete)
  File "/usr/share/sabnzbdplus/sabnzbd/newsunpack.py", line 983, in seven_extract
    fail, new_files, msg = seven_extract_core(sevenset, extensions, extraction_path, one_folder, delete, password)
  File "/usr/share/sabnzbdplus/sabnzbd/newsunpack.py", line 1034, in seven_extract_core
    stup, need_shell, command, creationflags = build_command(command)
  File "/usr/share/sabnzbdplus/sabnzbd/newsunpack.py", line 2006, in build_command
    if command[0].endswith('.py'):
AttributeError: 'NoneType' object has no attribute 'endswith'
sanderjo commented 5 years ago

I've created the fix, at the beginning of seven_extract(), with result:

image

So text is No 7za binary found, so cannot unpack "reftestnzb-7z-instead-of-rar-ea5b7e8fcddd" (file blabla.7z)

NZB for testing: https://raw.githubusercontent.com/sanderjo/NZBs/master/reftestnzb-7z-instead-of-rar-ea5b7e8fcddd.nzb

I'll send the PR.

sanderjo commented 5 years ago

... and some extra ... which should never happen.

image

sanderjo commented 5 years ago

Solved by https://github.com/sabnzbd/sabnzbd/pull/1309