[tor-commits] [ooni-probe/master] Exit cleanly if we can't find the probes IP address

art at torproject.org art at torproject.org
Wed Feb 4 13:27:16 UTC 2015


commit 9c2802dc85d14e9a4e03b61bbf61abfd0e88c25f
Author: Arturo Filastò <art at fuffa.org>
Date:   Mon Jan 19 10:50:12 2015 +0100

    Exit cleanly if we can't find the probes IP address
---
 ooni/deckgen/cli.py |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ooni/deckgen/cli.py b/ooni/deckgen/cli.py
index 3f4342a..1f618b7 100644
--- a/ooni/deckgen/cli.py
+++ b/ooni/deckgen/cli.py
@@ -8,6 +8,7 @@ import yaml
 from twisted.internet import defer
 from twisted.python import usage
 
+from ooni import errors
 from ooni.geoip import ProbeIP
 from ooni.settings import config
 
@@ -138,7 +139,12 @@ def run():
         options['output'] = os.getcwd()
 
     if not options['country-code']:
-        options['country-code'] = yield get_user_country_code()
+        try:
+            options['country-code'] = yield get_user_country_code()
+        except errors.ProbeIPUnknown:
+            print "Could not determine your IP address."
+            print "Check your internet connection or specify a country code with -c."
+            sys.exit(4)
 
     if len(options['country-code']) != 2:
         print "%s: --country-code must be 2 characters" % sys.argv[0]





More information about the tor-commits mailing list