From 2b1112258e0c88bcbffef3247678f168b887e8ff Mon Sep 17 00:00:00 2001 From: Rnhmjoj Date: Thu, 4 Dec 2014 20:03:40 +0100 Subject: [PATCH] Fix unbound local error --- pirate-get.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pirate-get.py b/pirate-get.py index eb5a123..ccdcc42 100755 --- a/pirate-get.py +++ b/pirate-get.py @@ -306,13 +306,13 @@ def print_search_results(mags, sizes, uploaded): torrent_name = parse.unquote(name.group(1)).replace('+', ' ') # enhanced print output with justified columns - print('{:4} {:5} {:5} {:5.1f} {:5.1f} {:3}' - ' {:<11} {:{length}}'.format(m, no_seeders, no_leechers, - ratio, float(sizes[m][0]), - sizes[m][1], uploaded[m], - torrent_name[:columns], - length=columns), - color=cur_color) + print('{:4} {:5} {:5} {:5.1f} {:5.1f} {:3} ' + '{:<11} {:{length}}'.format(m, no_seeders, no_leechers, + ratio, float(sizes[m][0]), + sizes[m][1], uploaded[m], + torrent_name[:columns], + length=columns), + color=cur_color) def print_descriptions(chosen_links, mags, site, identifiers): @@ -438,7 +438,7 @@ def main(): if args.database: mags = local(args) else: - mirrors = ['http://thepiratebay.se'] + mags, mirrors = [], ['http://thepiratebay.se'] try: opener = request.build_opener(NoRedirection) f = opener.open('https://proxybay.info/list.txt', timeout=5) @@ -458,7 +458,7 @@ def main(): except URLError: print('Failed', color='WARN') - if not mags or len(mags) == 0: + if not mags: print('No results') return