only use pythonw.exe on Windows platform and display error in Sublime Console instead of using python.exe
This commit is contained in:
parent
5616206b48
commit
78a7e5cbcb
1 changed files with 17 additions and 13 deletions
20
WakaTime.py
20
WakaTime.py
|
@ -91,14 +91,14 @@ def prompt_api_key():
|
|||
def python_binary():
|
||||
python = 'python'
|
||||
if platform.system() == 'Windows':
|
||||
python = 'pythonw'
|
||||
try:
|
||||
Popen([python, '--version'])
|
||||
except:
|
||||
for path in glob.iglob('/python*'):
|
||||
if exists(realpath(join(path, 'pythonw.exe'))):
|
||||
python = realpath(join(path, 'pythonw'))
|
||||
break
|
||||
return realpath(join(path, 'pythonw'))
|
||||
try:
|
||||
python = 'pythonw'
|
||||
Popen([python, '--version'])
|
||||
except:
|
||||
python = None
|
||||
return python
|
||||
|
||||
|
||||
|
@ -166,9 +166,13 @@ class SendActionThread(threading.Thread):
|
|||
print(cmd)
|
||||
code = wakatime.main(cmd)
|
||||
if code != 0:
|
||||
print('Error: Response code %d from wakatime package' % code)
|
||||
print('Error: Response code %d from wakatime package.' % code)
|
||||
else:
|
||||
cmd.insert(0, python_binary())
|
||||
python = python_binary()
|
||||
if not python:
|
||||
print('Error: Could not find python binary.')
|
||||
else:
|
||||
cmd.insert(0, python)
|
||||
if self.debug:
|
||||
print(cmd)
|
||||
if platform.system() == 'Windows':
|
||||
|
|
Loading…
Reference in a new issue