You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2015/10/13 18:36:51 UTC
svn commit: r1708462 - /comdev/reporter.apache.org/trunk/prettify.py
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