Skip to content

Commit 5c7daf7

Browse files
committed
Print error when config file can't be parsed
There may not be anything wrong with the API key. In my case, there was a trailing comma in the last key-value pair in the config file (copied from your_config_file.cfg). Print out the stacktrace to help track down the issue to the exact line.
1 parent 65dd22e commit 5c7daf7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

cfg/auth.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ def get_api_key(tileserver):
7676
data = json.load(json_data_file)
7777
api_key = data['imagery'][tileserver]
7878
return api_key
79-
except:
80-
print("Something is wrong with your API key."
81-
"Do you even have an API key?")
82-
sys.exit()
79+
except Exception:
80+
print("Couldn't parse %s as JSON" % CONFIG_PATH)
81+
raise
8382

8483

8584
# get the import submission_key

cfg/your_config_file.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"imagery":{
1616
"bing": "your_bing_api_key",
1717
"digital_globe": "your_digital_globe_api_key",
18-
"google": "your_google_api_key",
18+
"google": "your_google_api_key"
1919
},
2020
"slack":{
2121
"token": "your_slack_token",

0 commit comments

Comments
 (0)