[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59198] trunk/blender/release/scripts/ templates_py/script_stub.py: use 'with' keyword for script stub ( recommended with py3).

Campbell Barton ideasman42 at gmail.com
Sat Aug 17 07:28:01 CEST 2013


Revision: 59198
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59198
Author:   campbellbarton
Date:     2013-08-17 05:27:58 +0000 (Sat, 17 Aug 2013)
Log Message:
-----------
use 'with' keyword for script stub (recommended with py3).

Modified Paths:
--------------
    trunk/blender/release/scripts/templates_py/script_stub.py

Modified: trunk/blender/release/scripts/templates_py/script_stub.py
===================================================================
--- trunk/blender/release/scripts/templates_py/script_stub.py	2013-08-17 04:48:34 UTC (rev 59197)
+++ trunk/blender/release/scripts/templates_py/script_stub.py	2013-08-17 05:27:58 UTC (rev 59198)
@@ -9,6 +9,6 @@
 
 filepath = os.path.join(os.path.dirname(bpy.data.filepath), filename)
 global_namespace = {"__file__": filepath, "__name__": "__main__"}
-file = open(filepath, 'rb')
-exec(compile(file.read(), filepath, 'exec'), global_namespace)
-file.close()
+with open(filepath, 'rb') as file:
+    exec(compile(file.read(), filepath, 'exec'), global_namespace)
+




More information about the Bf-blender-cvs mailing list