|
1 | 1 | #!/usr/bin/env python |
2 | 2 |
|
| 3 | +from __future__ import absolute_import |
| 4 | +from __future__ import print_function |
3 | 5 | import optparse |
4 | 6 | import sys |
5 | 7 | import subprocess |
@@ -459,7 +461,7 @@ def parse_job_ad(): |
459 | 461 | match = re.search('^\s*(Owner|ProjectName)\s=\s"(.*)"', line, re.IGNORECASE) |
460 | 462 | if match: |
461 | 463 | temp_list[match.group(1)] = match.group(2) |
462 | | - except IOError, e: |
| 464 | + except IOError as e: |
463 | 465 | logging.error("Unable to open the .job.ad file") |
464 | 466 |
|
465 | 467 | return temp_list |
@@ -495,7 +497,7 @@ def _es_send(payload): |
495 | 497 | f = urllib2.urlopen(req) |
496 | 498 | f.read() |
497 | 499 | f.close() |
498 | | - except urllib2.URLError, e: |
| 500 | + except urllib2.URLError as e: |
499 | 501 | logging.warning("Error posting to ES: %s", str(e)) |
500 | 502 |
|
501 | 503 | p = multiprocessing.Process(target=_es_send, name="_es_send", args=(payload,)) |
@@ -689,7 +691,7 @@ def get_stashservers_caches(responselines): |
689 | 691 | for l in lists[0:-1]: |
690 | 692 | names = names + ',' + l.split('=')[0] |
691 | 693 | # skip leading comma |
692 | | - print(names[1:]) |
| 694 | + print((names[1:])) |
693 | 695 | sys.exit(0) |
694 | 696 |
|
695 | 697 | if cache_list_name == None: |
@@ -763,9 +765,9 @@ def get_best_stashcache(): |
763 | 765 | response.close() |
764 | 766 | break |
765 | 767 | response.close() |
766 | | - except urllib2.URLError, e: |
| 768 | + except urllib2.URLError as e: |
767 | 769 | logging.debug("URL error: %s", str(e)) |
768 | | - except Exception, e: |
| 770 | + except Exception as e: |
769 | 771 | logging.debug("Error: %s", str(e)) |
770 | 772 | i+=1 |
771 | 773 |
|
@@ -857,7 +859,7 @@ def main(): |
857 | 859 |
|
858 | 860 | cache_list_name = args.cache_list_name |
859 | 861 | if args.closest or args.list_names: |
860 | | - print get_best_stashcache() |
| 862 | + print(get_best_stashcache()) |
861 | 863 | sys.exit(0) |
862 | 864 |
|
863 | 865 | if len(opts) != 2: |
|
0 commit comments