Skip to content

Commit

Permalink
Exit cleanly if we can't find the probes IP address
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Feb 4, 2015
1 parent d3981af commit 9c2802d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ooni/deckgen/cli.py
Expand Up @@ -8,6 +8,7 @@
from twisted.internet import defer
from twisted.python import usage

from ooni import errors
from ooni.geoip import ProbeIP
from ooni.settings import config

Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 9c2802d

Please sign in to comment.