X-Git-Url: https://code.delx.au/webdl/blobdiff_plain/8ecea31e24a037c71cb25bd7e581acbc81be0b35..e28e3244b08a9727b39215f908d53b79f0a83cf4:/grabber.py diff --git a/grabber.py b/grabber.py index 61cfcec..cb71e0b 100755 --- a/grabber.py +++ b/grabber.py @@ -1,17 +1,17 @@ -#!/usr/bin/python2 +#!/usr/bin/env python3 from common import load_root_node, natural_sort -import sys + def choose(options, allow_multi): reverse_map = {} for i, (key, value) in enumerate(options): - print "%3d) %s" % (i+1, key.encode('utf-8')) + print("%3d) %s" % (i+1, key)) reverse_map[i+1] = value - print " 0) Back" + print(" 0) Back") while True: try: - values = map(int, raw_input("Choose> ").split()) + values = list(map(int, input("Choose> ").split())) if len(values) == 0: continue if 0 in values: @@ -23,7 +23,7 @@ def choose(options, allow_multi): if len(values) == 1: return values[0] except (ValueError, IndexError): - print >>sys.stderr, "Invalid input, please try again" + print("Invalid input, please try again") pass def main(): @@ -46,7 +46,7 @@ def main(): elif will_download: for n in result: if not n.download(): - raw_input("Press return to continue...\n") + input("Press return to continue...\n") else: node = result @@ -54,5 +54,5 @@ if __name__ == "__main__": try: main() except (KeyboardInterrupt, EOFError): - print "\nExiting..." + print("\nExiting...")