For work I have to use Python 2.7.
But when I use the "debug my python file" function in VS Code, I get an error.
Even with a simple program, like :
print()
For work I have to use Python 2.7.
But when I use the "debug my python file" function in VS Code, I get an error.
Even with a simple program, like :
print()
As rioV8 said in a comment, you have to install a previous version of the Python extension, because in the meanwhile support for Python 2 has been dropped.
To install a previous version you have to:
If you want to understand why you need version v2021.9.1246542782:
The component that provides support to the language is Jedi, and the release notes of version 0.17.2 (2020-07-17) say that
This will be the last release that supports Python 2 and Python 3.5.
0.18.0
will be Python 3.6+.
And according to the release notes of the Python extension, the latest version that was based on Jedi 0.17 was 2021.9.3 (20 September 2021), because the following one (2021.10.0, 7 October 2021) says
Phase out Jedi 0.17
Is that all? No, because the selection that VS Code offers when selecting previous versions uses a different numbering scheme. Anyway, the latest one of the v2021.9.* branch is v2021.9.1246542782, which I suppose corresponds to 2021.9.3, so it's the one you need.