diff options
author | Laurent Bachelier <laurent@bachelier.name> | 2010-01-13 20:47:20 +0100 |
---|---|---|
committer | Laurent Bachelier <laurent@bachelier.name> | 2010-01-13 20:47:20 +0100 |
commit | ba72602d2333cf0f499d4e6a981c55a4e11b1f52 (patch) | |
tree | b8b151f246d282d802ddb770aeb04c193aaec3d8 | |
parent | Fixed symlinks relative path on subdirectories (diff) | |
download | confman-ba72602d2333cf0f499d4e6a981c55a4e11b1f52.tar.xz |
Close the file after opening it
-rw-r--r-- | confman.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1,3 +1,5 @@ +from __future__ import with_statement + import os import re @@ -115,8 +117,8 @@ class ProgrammableConfigAction(ConfigAction): source = self.source_path() try: - exec compile(open(source).read(), source, 'exec') \ - in exec_env + with open(source, "r") as file: + exec compile(file.read(), source, 'exec') in exec_env except SymlinkForwarder as e: self.proxy = SymlinkConfigAction(self.config, self.relpath, e.filename, self.dest) except IgnoreForwarder as e: |