question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running interpreterInfo.py with non-specified python executables?

See original GitHub issue

Environment data

  • Language Server version: 0.5.31.0
  • OS and version: CentOS7
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.6

Behaviour

In atop I’m seeing lots of lines like this; note the python3.4:

  2897     - S   0% /home/mroos/.vscode-server/extensions/ms-python.python-2020.2.63990/languageServer.0.5.31/Microsoft.Python.LanguageServer
 2648     - S   0% /usr/bin/python3.4 /home/mroos/.vscode-server/extensions/ms-python.python-2020.2.63990/pythonFiles/interpreterInfo.py
 2657     - S   0% /usr/bin/python3.4 /home/mroos/.vscode-server/extensions/ms-python.python-2020.2.63990/pythonFiles/interpreterInfo.py
 2666     - S   0% /bin/python3.4 /home/mroos/.vscode-server/extensions/ms-python.python-2020.2.63990/pythonFiles/interpreterInfo.py

python3.4 is not installed, but is on my path. (It’s symlinked to something that installs python3.4 as part of an internal tool)

python3.4 isn’t resolved from which python, which python2, which python3. Further, I defined python.pythonPath as a python in a venv.

Any idea how the extension is finding python3.4 and attempting to run interpreterInfo.py?

Logs

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'LS - enabled'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'WebHostNotebook - control'
> conda --version
> pyenv root
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> ~/workspace/corpfin/.venv/bin/python3 -c "import sys;print(sys.executable)"
> conda info --json
> conda env list

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
karthiknadigcommented, Feb 26, 2020

Extension will use the binary pointed to by pythonpath to run your code or other tools. But it will search the OS for other versions.

If the python* in /bin/ or /usr/bin/ is replaced with something malicious. At that point a simple ~/.bashrc or the one that conda installs or even doing npm install that installs some native module will trigger that. Something as simple as opening a terminal (outside of VS Code) might be enough to run the malicious code. This is all even before getting to VS Code, let alone the python extension.

1reaction
jakebaileycommented, Feb 21, 2020

Transferring to the extension, this is a question about extension interpreter selection.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get the python.exe location programmatically? [duplicate]
Basically I want to get a handle of the python interpreter so I can pass a script file to execute (from an external...
Read more >
Configure Interpreter - PyDev
Usually running (from the command prompt) the file that gives that info for PyDev can help you discovering the ... In Python: python.exe...
Read more >
Python Rules | Bazel
In both cases, an "interpreter" means any executable binary or wrapper script that is capable of running a Python script passed on the...
Read more >
2. Using the Python Interpreter — Python 3.11.1 documentation
If you have the py.exe launcher installed, you can use the py command. ... When a script file is used, it is sometimes...
Read more >
Unpacking Python Executables on Windows and Linux - Fortinet
This is easy if one runs their own python code; however, ... Compiles all .py source files to python bytecode (.pyc files) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found