Skip to content

Commit 1b649df

Browse files
authored
Use sys.executable in flake8 plugin to make tests pass on systems that don't provide a python link (#111)
1 parent 2e06283 commit 1b649df

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pylsp/plugins/flake8_lint.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
import os.path
77
import re
8+
import sys
89
from pathlib import PurePath
910
from subprocess import PIPE, Popen
1011

@@ -81,8 +82,8 @@ def run_flake8(flake8_executable, args, document):
8182
cmd.extend(args)
8283
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
8384
except IOError:
84-
log.debug("Can't execute %s. Trying with 'python -m flake8'", flake8_executable)
85-
cmd = ['python', '-m', 'flake8']
85+
log.debug("Can't execute %s. Trying with '%s -m flake8'", flake8_executable, sys.executable)
86+
cmd = [sys.executable, '-m', 'flake8']
8687
cmd.extend(args)
8788
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with
8889
(stdout, stderr) = p.communicate(document.source.encode())

0 commit comments

Comments
 (0)