diff --git a/pylsp/plugins/flake8_lint.py b/pylsp/plugins/flake8_lint.py index aefd09ef..0ffc48f7 100644 --- a/pylsp/plugins/flake8_lint.py +++ b/pylsp/plugins/flake8_lint.py @@ -5,6 +5,7 @@ import logging import os.path import re +import sys from pathlib import PurePath from subprocess import PIPE, Popen @@ -81,8 +82,8 @@ def run_flake8(flake8_executable, args, document): cmd.extend(args) p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) except IOError: - log.debug("Can't execute %s. Trying with 'python -m flake8'", flake8_executable) - cmd = ['python', '-m', 'flake8'] + log.debug("Can't execute %s. Trying with '%s -m flake8'", flake8_executable, sys.executable) + cmd = [sys.executable, '-m', 'flake8'] cmd.extend(args) p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with (stdout, stderr) = p.communicate(document.source.encode())