diff -r fe5cd20cb0eb -r 9a18f4dbb493 DataViews/CodeMetrics.py --- a/DataViews/CodeMetrics.py Sun Jan 10 13:59:15 2010 +0000 +++ b/DataViews/CodeMetrics.py Sun Jan 10 19:19:52 2010 +0000 @@ -211,11 +211,10 @@ @param total dictionary receiving the overall code statistics @return a statistics object with the collected code statistics (SourceStat) """ - file = open(filename, 'r') try: - text = file.read() - finally: - file.close() + text = Utilities.readEncodedFile(filename)[0] + except (UnicodeError, IOError): + return SourceStat() parser = Parser() parser.parse(text)