[tor-commits] [ooni-probe/master] * Fixed oonicli.py trying to catch the wrong exception.

isis at torproject.org isis at torproject.org
Thu Nov 8 07:44:08 UTC 2012


commit 1739910de4b4744213961a00c9f0f56a76b52f7a
Author: Isis Lovecruft <isis at torproject.org>
Date:   Mon Nov 5 13:58:26 2012 +0000

    * Fixed oonicli.py trying to catch the wrong exception.
    * Added a docstring in oonicli.py.
    * Fixed oonicli.py not printing the help/info message when called without arguments.
---
 ooni/oonicli.py |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index b9f1dee..a61b3f9 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -77,7 +77,6 @@ class Options(usage.Options, app.ReactorSelectionMixin):
     def parseArgs(self, *args):
         try:
             self['test'] = args[0]
-
             self['subArgs'] = args[1:]
         except:
             raise usage.UsageError("No test filename specified!")
@@ -87,16 +86,23 @@ class Options(usage.Options, app.ReactorSelectionMixin):
 
 
 def run():
-    log.start()
+    """
+    Call me to begin testing a file or module.
+    """
 
-    if len(sys.argv) == 1:
-        sys.argv.append("--help")
     config = Options()
+
+    if len(sys.argv) == 1:
+        config.getUsage()
+
     try:
         config.parseOptions()
-    except usage.error, ue:
+    except usage.UsageError, ue:
         raise SystemExit, "%s: %s" % (sys.argv[0], ue)
 
+    log.start()
+    log.debug("oonicli.run: config set to %s" % config)
+
     if config['debug-stacktraces']:
         defer.setDebugging(True)
 





More information about the tor-commits mailing list