0

My application has built-in Python interpreter and I need to debug Python code there. However Visual Studio Code allows to choose only from interpreters found in paths and named python/python2/python3.

I tried to set python.pythonPath in settings.json to point to my application, but Visual Studio Code doesn't recognize it as valid Python interpreter.

Sure, I need to make sure that my application behave like Python interpreter and pass all command-line parameters to Python ptvsd_launcher.py.

1
  • How did you acquire this additional Python interpreter? Did you install it from somewhere? What does VSCode say about it? Commented Jul 30, 2019 at 18:16

1 Answer 1

1

The "python.pythonPath" setting is how you can specify a Python interpreter that is not automatically detected. If the binary does not function as a normal python binary then unfortunately there's no way for the extension to use it.

Sign up to request clarification or add additional context in comments.

8 Comments

But what is expected from Python? My program has own header text, but internally it should accept Python script as command line argument and then execute it with built-in interpreter.
@EugeneZelenko Basically it needs to support -c "import sys;print(sys.executable)" and be able to run pythonFiles\interpreterInfo.py in order to find out interpreter details that are needed.
Thank you for clarifications! My program could execute second command but not first because it doesn't support -c and this should be fixed.
Thank you a lot for information! I added wrapper for my program to handle -c and also to remove boilerplate and it works fine with Visual Studio Code. I think will be good idea to add requirements for Python interpreter in documentation, so other programs with built-in Python could easily benefit debugging with Visual Studio Code.
@EugeneZelenko Doc change suggestions should be made at github.com/microsoft/vscode-docs, although in our release that went out yesterday this should be more obvious now and so it might not require specific documentation.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.