From 385ba818cccf4513936a907981b54bc81c02e847 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Sun, 5 Nov 2017 20:04:48 -0800 Subject: [PATCH] ability to override python binary location --- WakaTime.py | 8 ++++++-- WakaTime.sublime-settings | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/WakaTime.py b/WakaTime.py index b2c2ab6..7c9d3ab 100644 --- a/WakaTime.py +++ b/WakaTime.py @@ -465,6 +465,7 @@ class SendHeartbeatsThread(threading.Thread): self.include = SETTINGS.get('include', []) self.hidefilenames = SETTINGS.get('hidefilenames') self.proxy = SETTINGS.get('proxy') + self.python_binary = SETTINGS.get('python_binary') self.heartbeat = heartbeat self.has_extra_heartbeats = False @@ -501,11 +502,14 @@ class SendHeartbeatsThread(threading.Thread): return heartbeat def send_heartbeats(self): - if python_binary(): + python = self.python_binary + if not python or not python.strip(): + python = python_binary() + if python: heartbeat = self.build_heartbeat(**self.heartbeat) ua = 'sublime/%d sublime-wakatime/%s' % (ST_VERSION, __version__) cmd = [ - python_binary(), + python, API_CLIENT, '--entity', heartbeat['entity'], '--time', str('%f' % heartbeat['timestamp']), diff --git a/WakaTime.sublime-settings b/WakaTime.sublime-settings index 07e1934..e461b5f 100644 --- a/WakaTime.sublime-settings +++ b/WakaTime.sublime-settings @@ -29,5 +29,8 @@ "status_bar_message_fmt": "WakaTime {status} %I:%M %p", // Obfuscate file paths when sending to API. Your dashboard will no longer display coding activity per file. - "hidefilenames": false + "hidefilenames": false, + + // Python binary location. Uses python from your PATH by default. + "python_binary": "" }