DataViews/CodeMetrics.py

changeset 45
9a18f4dbb493
parent 13
1af94a91f439
child 96
9624a110667d
--- 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)

eric ide

mercurial