mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
open flow files using with as max suggested
This commit is contained in:
parent
c4aeca2764
commit
4f578866fa
@ -501,7 +501,7 @@ class ConsoleMaster(flow.FlowMaster):
|
|||||||
flows = []
|
flows = []
|
||||||
for path in paths:
|
for path in paths:
|
||||||
path = os.path.expanduser(path)
|
path = os.path.expanduser(path)
|
||||||
f = file(path, "rb")
|
with file(path, "rb") as f:
|
||||||
flows.extend(list(flow.FlowReader(f).stream()))
|
flows.extend(list(flow.FlowReader(f).stream()))
|
||||||
except (IOError, flow.FlowReadError), v:
|
except (IOError, flow.FlowReadError), v:
|
||||||
return True, v.strerror
|
return True, v.strerror
|
||||||
|
@ -148,7 +148,7 @@ class DumpMaster(flow.FlowMaster):
|
|||||||
flows = []
|
flows = []
|
||||||
for path in paths:
|
for path in paths:
|
||||||
path = os.path.expanduser(path)
|
path = os.path.expanduser(path)
|
||||||
f = file(path, "rb")
|
with file(path, "rb") as f:
|
||||||
flows.extend(list(flow.FlowReader(f).stream()))
|
flows.extend(list(flow.FlowReader(f).stream()))
|
||||||
except (IOError, flow.FlowReadError), v:
|
except (IOError, flow.FlowReadError), v:
|
||||||
raise DumpError(v.strerror)
|
raise DumpError(v.strerror)
|
||||||
|
Loading…
Reference in New Issue
Block a user