Wrap the file writing operations inside a with statement to simplify code.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116486 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/scripts/Python/append-debugger-id.py b/scripts/Python/append-debugger-id.py
index 474443a..e1e3628 100644
--- a/scripts/Python/append-debugger-id.py
+++ b/scripts/Python/append-debugger-id.py
@@ -18,14 +18,6 @@
 
 # print "output_name is '" + output_name + "'"
 
-try:
-    f_out = open (output_name, 'a')
-except IOError:
-    print "Error:  Unable to open file for appending: " + output_name
-else:
-    f_out.write ("debugger_unique_id = 0\n");
-    f_out.write ("SBDebugger.Initialize()\n");
-    try:
-        f_out.close()
-    except IOError:
-        print "Error occurred while close file."
+with open(output_name, 'a') as f_out:
+    f_out.write("debugger_unique_id = 0\n")
+    f_out.write("SBDebugger.Initialize()\n")