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