summaryrefslogtreecommitdiff
path: root/pylint/epylint.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-03-28 09:33:20 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2019-03-28 09:33:20 +0100
commit95232ca07a5514f1242c7fb11a7504a24e78192d (patch)
tree6d0daf7969048cac873b0240338609c70fb332e1 /pylint/epylint.py
parent8a0574ead7c69c4ddeb2e2f478fe973896ad1121 (diff)
downloadpylint-git-95232ca07a5514f1242c7fb11a7504a24e78192d.tar.gz
``epylint.py_run`` defaults to ``python`` in case the current executable is not a Python one.
Close #2837
Diffstat (limited to 'pylint/epylint.py')
-rwxr-xr-xpylint/epylint.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pylint/epylint.py b/pylint/epylint.py
index c2d4a21d8..8e246e55c 100755
--- a/pylint/epylint.py
+++ b/pylint/epylint.py
@@ -149,8 +149,11 @@ def py_run(command_options="", return_std=False, stdout=None, stderr=None):
To silently run Pylint on a module, and get its standard output and error:
>>> (pylint_stdout, pylint_stderr) = py_run( 'module_name.py', True)
"""
+ # Detect if we use Python as executable or not, else default to `python`
+ executable = sys.executable if "python" in sys.executable else "python"
+
# Create command line to call pylint
- epylint_part = [sys.executable, "-c", "from pylint import epylint;epylint.Run()"]
+ epylint_part = [executable, "-c", "from pylint import epylint;epylint.Run()"]
options = shlex.split(command_options, posix=not sys.platform.startswith("win"))
cli = epylint_part + options