[tor-commits] [metrics-tasks/master] task-6329: Display usage when details.json cannot be found

karsten at torproject.org karsten at torproject.org
Sun Jul 15 08:17:02 UTC 2012


commit c91ad8eaf8a05f839a8270986a72599ccc2b8ca9
Author: delber <delber at riseup.net>
Date:   Sat Jul 14 13:03:49 2012 +0000

    task-6329: Display usage when details.json cannot be found
---
 task-6329/tor-relays-stats.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/task-6329/tor-relays-stats.py b/task-6329/tor-relays-stats.py
index 5f6f633..cbb70ac 100755
--- a/task-6329/tor-relays-stats.py
+++ b/task-6329/tor-relays-stats.py
@@ -9,6 +9,7 @@
 import json
 import operator
 import sys
+import os.path
 
 class RelayStats(object):
     def __init__(self):
@@ -118,6 +119,8 @@ can issue the following command:
     sys.exit(1)
 
 if '__main__' == __name__:
+    if not os.path.exists('details.json'):
+        usage()
     if len(sys.argv) == 1:
         usage()
     func = OUTPUTS.get(sys.argv[1], None)



More information about the tor-commits mailing list