aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmproxy/console/__init__.py4
-rw-r--r--libmproxy/dump.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py
index b2f4d96c..559c78d4 100644
--- a/libmproxy/console/__init__.py
+++ b/libmproxy/console/__init__.py
@@ -501,8 +501,8 @@ class ConsoleMaster(flow.FlowMaster):
flows = []
for path in paths:
path = os.path.expanduser(path)
- f = file(path, "rb")
- flows.extend(list(flow.FlowReader(f).stream()))
+ with file(path, "rb") as f:
+ flows.extend(list(flow.FlowReader(f).stream()))
except (IOError, flow.FlowReadError), v:
return True, v.strerror
return False, flows
diff --git a/libmproxy/dump.py b/libmproxy/dump.py
index c4a70a14..70f175f6 100644
--- a/libmproxy/dump.py
+++ b/libmproxy/dump.py
@@ -148,8 +148,8 @@ class DumpMaster(flow.FlowMaster):
flows = []
for path in paths:
path = os.path.expanduser(path)
- f = file(path, "rb")
- flows.extend(list(flow.FlowReader(f).stream()))
+ with file(path, "rb") as f:
+ flows.extend(list(flow.FlowReader(f).stream()))
except (IOError, flow.FlowReadError), v:
raise DumpError(v.strerror)
return flows