143 questions
1
vote
1
answer
76
views
VS Code hangs at Pytest discovery
I'm having issues with getting VS Code to integrate Pytest discovery, where it just hangs indefinitely on discovering tests for the workspace. I've tried about every solution, and I have a minimal ...
0
votes
0
answers
111
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
...
0
votes
0
answers
91
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 ...
0
votes
1
answer
53
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 ...
-1
votes
1
answer
83
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": &...
0
votes
0
answers
47
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 ...
2
votes
1
answer
301
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
1
answer
225
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:...
0
votes
0
answers
115
views
Why cls() in a classmethod does not provide argument hints the way that directly calling the class constructor does?
I'm trying to make a subclass with a @classmethod that would take as arguments an instance of its superclass and kwargs for its other fields. The goal is to be able to take an object of the general ...
1
vote
1
answer
633
views
Visual studio Code Python Intellisense not detecting return types
In past i always made functions that get a type/class as argument and create an instance of that type, returning the instance. E.g:
def CreateWidget(self, widgetType, show = True, name = '', x = 0,...
0
votes
1
answer
135
views
Support "View Value in Data Viewer" for custom class
In the VSCode Python debugger, I can right-click on numpy array or pandas DataFrame and select "View Value in Data Viewer". Is it possible to support this for a self-implemented class?
I ...
-1
votes
1
answer
178
views
In VS Code, where are user settings saved and where to look for them? [duplicate]
In vscode, I am quite confused where to change settings and where to find them.
There seems at least two places: Settings and Command Palette.
For a specific example, I am using vscode for Python.
I ...
0
votes
0
answers
76
views
VSCode Portable disable auto-expansion of folded blocks
In VSCode Portable, is there a method/setting to disable automatic expansion of folded functions (or other types of foldable blocks, I guess) on start-up? That is, if I fold a function block, close ...
1
vote
0
answers
670
views
VSCode debuging flask app creates Error [WinError 10038] on save/reload [duplicate]
Since few days I have an issue with reloading when debugging flask apps. Usually, when saving changes the debugger restarts and I could work on my app.
Now it still saves and reloads, but throws an ...
0
votes
1
answer
57
views
For loop iteration changing when I rerun the Python file
for i in range(1,5):
print(i)
a = input("Enter a Number")
If I don't Enter anything into the Input and Rerun the File again In VSCODE Terminal, The For loop iteration is advancing.
...
14
votes
1
answer
3k
views
Why are PyCharm and Pylance not detecting packages installed in editable mode?
Recently, code analysis tools like PyCharm and Pylance in VSCode are not picking up packages installed in editable mode (pip install -e <package_name>).
This made it so I could not navigate to ...
5
votes
3
answers
16k
views
VS Code issue when trying to install the Python extension: "end of central directory record signature not found"
When trying to install the Python extension I get the following error:
Error while installing 'Python' extension. Please check the [log](command:workbench.action.showWindowLog) for more details.
The ...
6
votes
1
answer
7k
views
VSCode Python Testing `Test result not found for...` bug
While working in a multi-project (VSCode would call it multi-root) python repository the VSCode python plugin for testing fails to run all the test when choosing to run all the tests, however running ...
3
votes
0
answers
305
views
Debug tox unit tests with visual studio code
I am trying to debug an existing set of unit tests that are run with tox. I updated my launch.json file to include the following configuration:
{
"module": "tox",
"...
1
vote
0
answers
368
views
How to get list of parent methods in VSCode?
In PyCharm I can hit Ctrl/Cmd + O and it'll give me a modal with all methods I can override. What's the equivalent in VSCode?
10
votes
1
answer
5k
views
What's pylint's TypeVar name specification?
Pylint gives a warning whenever something like this happens:
import typing
SEQ_FR = typing.TypeVar("SEQ_FR")
#^^^^^ gets underlined with the warning
The warning is like this: Type variable ...
1
vote
1
answer
435
views
What is the alternative to python.pythonPath in settings.json?
In a Python tutorial I'm following, the Python path is linked to the python.pythonPath setting in the settings.json file of Visual Studio Code. However, the python.pythonPath does not exist anymore.
I ...
1
vote
1
answer
5k
views
vscode python: how to log to both file and terminal
Before adding logging to my project, i would see all logs from libraries such as flask in the terminal console. After adding the following, i no longer see these output in the terminal - but they do ...
6
votes
1
answer
4k
views
vscode/pylance auto-import incorrect root path
Let's suppose that I have a project with this file structure:
project_dir
└── src
├── package1
│ └── module1.py
└── package2
└── module2.py
When I want to use some class from ...
1
vote
0
answers
294
views
How to search python function definitions across all installed packages in vscode
I want to search for a function name across all installed packages and also in the packages defined by python.autoComplete.extraPaths vscode setting.
Vscode search panel searches only in the current ...