community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1708462 - /comdev/reporter.apache.org/trunk/prettify.py
Date Tue, 13 Oct 2015 16:36:51 GMT
Author: sebb
Date: Tue Oct 13 16:36:50 2015
New Revision: 1708462

URL: http://svn.apache.org/viewvc?rev=1708462&view=rev
Log:
Simplify and catch both read and write errors

Modified:
    comdev/reporter.apache.org/trunk/prettify.py

Modified: comdev/reporter.apache.org/trunk/prettify.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/prettify.py?rev=1708462&r1=1708461&r2=1708462&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/prettify.py (original)
+++ comdev/reporter.apache.org/trunk/prettify.py Tue Oct 13 16:36:50 2015
@@ -25,13 +25,10 @@ for arg in args.file:
     try:
         with open(arg, "r") as f:
             input = json.loads(f.read())
-            f.close()
-    except Exception as ex:
-        print(ex)
-        pass
-    else:
         out = arg if args.clobber else arg + ".out"
         print("Writing " + out)
         with open(out, "w") as f:
             json.dump(input, f, indent=args.indent, sort_keys=sort_keys)
-            f.close()
+     # we catch exception so can continue to process other files
+    except Exception as ex:
+        print(ex)
\ No newline at end of file



Mime
View raw message