Show More
@@ -26,6 +26,11 b' import optparse' | |||||
26 | import os |
|
26 | import os | |
27 | import re |
|
27 | import re | |
28 | import sys |
|
28 | import sys | |
|
29 | if sys.version_info[0] < 3: | |||
|
30 | opentext = open | |||
|
31 | else: | |||
|
32 | def opentext(f): | |||
|
33 | return open(f, encoding='ascii') | |||
29 | try: |
|
34 | try: | |
30 | xrange |
|
35 | xrange | |
31 | except NameError: |
|
36 | except NameError: | |
@@ -491,8 +496,12 b' def checkfile(f, logfunc=_defaultlogger.' | |||||
491 | result = True |
|
496 | result = True | |
492 |
|
497 | |||
493 | try: |
|
498 | try: | |
494 | with open(f) as fp: |
|
499 | with opentext(f) as fp: | |
495 | pre = post = fp.read() |
|
500 | try: | |
|
501 | pre = post = fp.read() | |||
|
502 | except UnicodeDecodeError as e: | |||
|
503 | print("%s while reading %s" % (e, f)) | |||
|
504 | return result | |||
496 | except IOError as e: |
|
505 | except IOError as e: | |
497 | print("Skipping %s, %s" % (f, str(e).split(':', 1)[0])) |
|
506 | print("Skipping %s, %s" % (f, str(e).split(':', 1)[0])) | |
498 | return result |
|
507 | return result |
General Comments 0
You need to be logged in to leave comments.
Login now