[tor-commits] [chutney/master] A few python3 fixes

nickm at torproject.org nickm at torproject.org
Mon Dec 29 15:48:56 UTC 2014


commit 620ab9ece19410e5a746359b0167855da3b55444
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Dec 29 10:48:01 2014 -0500

    A few python3 fixes
---
 lib/chutney/TorNet.py |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index 4d365ad..2d2054b 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -285,9 +285,9 @@ class LocalNodeBuilder(NodeBuilder):
                     # well, this could get spammy
                     # TODO: warn once per option per tor binary
                     # TODO: print tor version?
-                    print ("The tor binary at %r does not support the "
+                    print (("The tor binary at %r does not support the "
                            "option in the torrc line:\n"
-                           "%r") % (tor, line.strip())
+                           "%r") % (tor, line.strip()))
                     # we could decide to skip these lines entirely
                     # TODO: write tor version?
                     f.writelines(["# " + tor + " unsupported: " + line])
@@ -887,19 +887,16 @@ def usage(network):
 
 
 def exit_on_error(err_msg):
-    print "Error: {0}\n".format(err_msg)
-    print usage(_THE_NETWORK)
+    print ("Error: {0}\n".format(err_msg))
+    print (usage(_THE_NETWORK))
     sys.exit(1)
 
-def runConfigFile(verb, path):
+def runConfigFile(verb, data):
     _GLOBALS = dict(_BASE_ENVIRON=_BASE_ENVIRON,
                     Node=Node,
                     ConfigureNodes=ConfigureNodes,
                     _THE_NETWORK=_THE_NETWORK)
 
-    with open(path) as f:
-        data = f.read()
-
     exec(data, _GLOBALS)
     network = _GLOBALS['_THE_NETWORK']
 





More information about the tor-commits mailing list