Questions tagged [vscode-python]

Questions about working with Python in Visual Studio Code using the Microsoft Python extension.

This VS extension makes VS Code a python IDE. Supports any operating system with most of Python interpreters. It provides IntelliSense, linting, debugging, and unit testing, environment switch using virtual and conda environments, etc.

127 questions
1
vote
0 answers

Why does the type-hinting for enum show an error on VS Code?

I've run into an issue where the expected return type (Enum) and the actual return type do not match, even though they should. The weird thing is that depending on the way that I write the return statement, the results are different. The following…
Joaquín
  • 367
  • 1
  • 9
1
vote
1 answer

using absolute import paths in Python code with VSCode

The workspace folder is myapp and the folder structure is the following: myapp/ main.py __init__.py module/ __init__.py math.py In the top level workspace folder in main.py I would like to import the math package using…
1
vote
1 answer

VSCode Python Intellisense not working with custom PYTHONPATH in .env file

I have a python project where the first line of code is something like sys.path.insert(0, /some/path). Then I try to import from this path. The code works at runtime, but VSCode can't figure out where this package is, and so I get squigglies on…
Zachary Turner
  • 738
  • 4
  • 24
1
vote
1 answer

VS Code Python debugger keeps launching powershell

I use VS Code with the Python extention regularly. Randomly this week when I try to enter debug mode via the usual approach, VS Code starts Powershell instead of the Windows Console like normal. This then fails. I've check and changed my default…
T. Shaffner
  • 359
  • 1
  • 5
  • 22
1
vote
0 answers

Pylint is not working in VSCode but work well as command in terminal

When I type "pylint" command in the terminal, it can work normally and show all kinds of errors for me as shown below. work_as_command But in VSCode, no hint is shown. The editor is as clean as no error existing, although I know there are several…
ggg
  • 11
  • 1
1
vote
2 answers

vscode-python - Can I use the data viewer's filters to apply 'greater-than' and 'less-than' filters simultaneously?

For the vscode-python plugin, I am using the 'data viewer' to explore a large array of data from a CSV file. The data viewer has a 'filters' tool (see picture), which can be used to (1) find matches in a column for specific values (e.g. 1996) and…
Cato Minor
  • 2,992
  • 3
  • 29
  • 42
1
vote
0 answers

Setup vscode MyPy for project with both Python2 and Python3

I have a vscode linux based project that is mainly Python2.7. The project started well before Python3 had momentum. In vscode settings I have to following to specify the code is for python2. "python.linting.mypyArgs": [ "--py2" ], Now, I have to…
BrendanSimon
  • 665
  • 1
  • 9
  • 23
1
vote
1 answer

magic_mock_db.connect.assert_called() fails even though it's called

I am using vscode-python's extension with python's unittest to test if peewee successfully connects to the database. This is the class that is being tested: import logging from datetime import (datetime, timezone) # 3rd party libraries import…
1
vote
1 answer

VS Code - can I disable the 'No Python interpreter' warning?

I use VS Code for multiple languages and don't always need an interpreter. I also use multiple Python versions, usually managed via Pipenv. I find the constant nagging to select an interpreter really annoying; can I disable it? After all, I'll soon…
nathanjw
  • 832
  • 2
  • 13
  • 23
1
vote
1 answer

VS code unable to create new cell while using iJAVA that is build on jshell?

I am just a beginner :) Can any one help me out?? When I click the plus sign to create a new cell in a workbook I get an error. The new cell isn't created and I see this error message in a larger than usual font. The error message survives a…
1
vote
1 answer

VS Code debug console won't work with Python input()

I have some simple code that works fine everywhere except the Debug Console on VS Code. Here it is: pounds = int(input("How much do you weigh in pounds? ")) kilos = pounds * 0.45359237 print("You weight " + str(kilos) + " kilograms.") If you use…
user8917421
1
vote
2 answers

Why doesn't Visual Studio Code highlight my object's methods?

I have this question, a simple code for example #Clase de Herencias " # " from colorama import * class vehiculos(): def __init__(self, marca, modelo): self.marca = marca self.modelo = modelo self.enmarcha = False self.acelera =…
1
vote
1 answer

Don't know if Azure function is logging any event, local development VS code in python

I am trying to develop an Azure function to interact with an IoTHub. I am doing a local development using Visual Studio Code 1.47.2 in python version 3.7.8. The function is a version 2 and uses Azure Functions Core Tools 2.7.2628. For the…
mnmurill
  • 11
  • 1
1
vote
0 answers

Debugging with Python Poetry and VS Code's SSH plugin

The typical way to run VS Code with a Poetry environment is $ poetry shell (poetry environment) $ code . However, this isn't possible when using VS Code's SSH plugin, which creates new remote shells as needed. Only commands deemed necessary by VS…
1
vote
3 answers

how to crate the group by in pandas only in one level

I am importing below df3 dataframe in my excel file and want to grouby only Name and rest dublicate data should reflect as below . Note (Each Month data will be added as per month wise. ) Df3 =pd.read_Excel('Data') print (df3) Name ID …
1 2 3
8 9