142 questions
3
votes
2
answers
135
views
Why won't VSCode Smart Send my Python code line by line to the terminal as it used to?
I generally just run my Python code line-by-line using the Python Smart Send feature on VSCode, but after I was away from work for a bit, it suddenly stopped working. Normally Shift + Enter or Right ...
0
votes
0
answers
104
views
Pausing or adding new breakpoints halfway during running in VSCode makes the Python Exception uncaught, unhandled, and lost
Pausing or adding new breakpoints halfway during debugging in VSCode seems to make the Python Exception uncaught.
The following is a minimal example to reproduce my problem.
import contextlib, signal
...
1
vote
1
answer
88
views
Multiple Python Paths
I have multiple Python Paths to choose from as seen in the images. I remember installing Python via brew and through the internet and Anaconda.
I don't have any idea which are redundant and what to ...
0
votes
0
answers
90
views
Can't deactivate python venv on vscode after recent update
I've recently updated vscode to the most recent version, and whenever I open up a new shell or cmd it activates the venv in that directory, and that's fine and expected as before.
But now it doesn't ...
1
vote
1
answer
71
views
Get current function name
Executing
vscode.executeDocumentSymbolProvider
gives me all symbols in the file.
Can I somehow get name of the function that the cursor is currently in?
0
votes
1
answer
45
views
VSCode Failing to properly activate venvs in workspace with more than one folder/interpreter
Had an issue start with VSCode the last week or so, and not sure if there's just something wrong with my system, my vscode config, or if there's just a vscode bug.
To start, I'm running on OSx Sequoia ...
0
votes
0
answers
30
views
VSCode python (remote) - slow "rename symbol" when opening parent/root directories?
Given I have stored my git repos at ~/git/project1, ~/git/groupA/foo, etc.
When I open the root directory ~/git with VSCode and refactor code via "rename symbol" or "rename file",
...
-1
votes
1
answer
80
views
vscode extension uses wrong python
I am trying to use sqlfluff linter, which is a SQL formatter and linter. In settings.json I have, among others, this:
"[sql]": {
"editor.defaultFormatter": &...
1
vote
0
answers
32
views
Is there a way to have VS Code, dynamically, only process/include folders and files I have open and exclude the rest?
I have a big repo of python snippets. pyright goes crazy because I have a bunch of little folders with scripts.
I don't want to have a manually turn it on/off or open specific folders as projects. I ...
0
votes
0
answers
43
views
vscode debugger highlights wrong line when adding/removing previous lines
Let's assume we have this python script, set breakpoint on second line and start debugging:
print(1)
print(2) # set breakpoint here
print(3)
print(4)
print(5)
Debugger stops here:
Now delete the ...
0
votes
1
answer
562
views
How do you remove a python venv from vscode?
I've added several custom virtual environments to vscode, so that when I use the command palette I can select from a variety of builtin ones, as well as my own.
I'd like to remove some of these, but I ...
2
votes
1
answer
278
views
How to set Visual Studio Code Python Interpreter to a Python Virtual Environment in a Parent Directory?
I have a python virtual environment in /Documents and a project in /Documents/Code/Python/example. I want to use this venv in my project but I can't get the vs code python interpreter to recognize ...
1
vote
0
answers
79
views
Pylint protected-access (W0212) warning on module functions not class methods
I receive PylintW0212:protected-access warnings when accessing functions of a module that are prefixed with a single underscore:
import my_module
my_module._function() # Pylint warning here
The ...
1
vote
1
answer
214
views
$PYTHONSTARTUP points to an old version of the extension
Somehow I got myself into a state where python is complaining about PYTHONSTARTUP pointing to a non-existant path. From the terminal tab:
% python
Python 3.11.8 (v3.11.8:db85d51d3e, Feb 6 2024, 18:...
2
votes
1
answer
1k
views
How to input command line arguments when using pytest in VS Code
I have setup my pytest testing to use optional command line arguments. I would like to run and debug these tests in VS Code. However, I am unable to get the command line arguments to work with VS Code....