From 6118fea823ca95195602223e3e94b3bc5e385263 Mon Sep 17 00:00:00 2001 From: rembo10 Date: Tue, 8 Apr 2014 15:13:35 -0700 Subject: [PATCH] Catch an exception if we can't compare versions on github --- headphones/versioncheck.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/headphones/versioncheck.py b/headphones/versioncheck.py index 0a9aaed7..17afc19b 100644 --- a/headphones/versioncheck.py +++ b/headphones/versioncheck.py @@ -144,8 +144,12 @@ def checkGithub(): logger.warn('Could not get commits behind from GitHub.') return headphones.CURRENT_VERSION - headphones.COMMITS_BEHIND = int(commits['behind_by']) - logger.debug("In total, %d commits behind", headphones.COMMITS_BEHIND) + try: + headphones.COMMITS_BEHIND = int(commits['behind_by']) + logger.debug("In total, %d commits behind", headphones.COMMITS_BEHIND) + except KeyError: + logger.info('Cannot compare versions. Are you running a local development version?') + headphones.COMMITS_BEHIND = 0 if headphones.COMMITS_BEHIND > 0: logger.info('New version is available. You are %s commits behind' % headphones.COMMITS_BEHIND)