Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-08-17 09:27:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-17 09:27:58 +0400
commit26334888774fcfe28efe12d42d1da69001fa9137 (patch)
tree852a44a39890c54db97aceaf7b91d56c7835bffd /release/scripts/templates_py
parent9d4bf6b37bf5ec29f4c8a3ba00bef555a9fce33f (diff)
use 'with' keyword for script stub (recommended with py3).
Diffstat (limited to 'release/scripts/templates_py')
-rw-r--r--release/scripts/templates_py/script_stub.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/release/scripts/templates_py/script_stub.py b/release/scripts/templates_py/script_stub.py
index 44c7b802e2c..3f56749f3b3 100644
--- a/release/scripts/templates_py/script_stub.py
+++ b/release/scripts/templates_py/script_stub.py
@@ -9,6 +9,6 @@ filename = "my_script.py"
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)
+