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
0
votes
2 answers

Python VSCode: Run Main file in Python Interactive Window

This seems like a basic question, but I can't seem to find a setting/process for it. In VSCode's Python extension, there is an option to right-click (or keyboard shortcut) in the editor and Run Current File in Python Interactive Window. This works…
secJ
  • 499
  • 3
  • 12
0
votes
1 answer

Why can't VSCode Python linter resolve import of file in the same directory?

Take the following folder structure. sidebar-update __init__.py index.py results.py When importing a given function in index.py from results.py with the statement from results import getResultsTable VSCode produces the following…
Joao Pereira
  • 573
  • 4
  • 16
0
votes
1 answer

Generating random numbers in Python using random.randrange(). After the final number is generated, a "%" is created. How can I fix this?

import random # Main menu. print('**** Welcome to the Pick-3, Pick-4 lottery number generator! ****\n\ \nSelect from the following menu:\n\n1. Generate 3-Digit Lottery number\ \n2. Generate 4-Digit Lottery number\n3. Exit the…
0
votes
0 answers

Jupyter Notebook Kernel Crashing in VSCODE

I am interested in using VSCode's Jupyter notebook functionality and I am just trying to get to grips with it. I can start the kernel and run the notebook cells in VSCode. After running particular cells it seems to crash with no warning and the…
0
votes
1 answer

Get VS Code Python extension to connect to Jupyter running on remote AWS EMR master node

I have a working Jupyter server running on an EMR master node where I can run python and pyspark code with no issue. When trying to get the VS Code Python extension to connect to the very same Jupyter server, I get the following error: Failed to…
Clay
  • 2,584
  • 1
  • 28
  • 63
0
votes
4 answers

Unexpected Python version in VS Code Terminal

I just installed VS Code, Python (version 3.7.5 released on Oct.15, 2019) on MacOS. So I run python --version on my VS Code Terminal, the result showed Python 2.7.11. Shouldn't it be 3.7.5?
0
votes
2 answers

How can I import pygame in vscode?

I've installed pygame on vscode but vscode can't import pygame showing this error ModuleNotFoundError: No module named 'pygame' Any help?
0
votes
0 answers

Configure working directory for Python REPL in Visual Studio Code on Windows

I'm new to both VS Code and Python, so I apologize if this is already possible, but for the life of me I couldn't see how to change this. I'm using: VS Code (Win) v1.42.0 vscode-python v2020.2.62710 Example: I open mypythonscript.py file in a…
pcdev
  • 2,852
  • 2
  • 23
  • 39
0
votes
1 answer

VSCode Python Language Server not shown anymore

VSCode Information: Version: 1.41.1 (system setup) Commit: 26076a4de974ead31f97692a0d32f90d735645c0 Date: 2019-12-18T14:58:56.166Z Electron: 6.1.5 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Windows_NT x64 10.0.18363 Python…
0
votes
1 answer

How to install python language server for vscode python extention offline

I'm working in a Linux offline environment for security reasons. We have a channel to get scanned files to the system so I can install python extension but can not install the python language server because vscode can not connect to the internet…
0
votes
2 answers

Add Custom python.pythonPath to List of Interpreters

I want to use a custom python interpreter, which you can do by adding to python.pythonPath, as seen in the image below. However, I thought that there would be an option so that I could add an interpreter to the list of available interpreters that…
0
votes
1 answer

Can I stop linters from clearing the Problems tab before they have results?

Is it possible to prevent linters in VSCode from clearing the current list of errors/warnings before they have the results ready? I find myself using pylint a lot, but it can be very slow (3-5 seconds for a large file). Unfortunately, every time a…
munieq11
  • 141
  • 5
  • 13
0
votes
1 answer

vscode doesn"t use the python path I gave him, and that it recognize

I gave to vscode-python my python path, but it doesn't use it to run my .py file, unless in debug mode.... what do I miss ? is it a bug ? suspected behavior: as there is a "py.exe" in the system, vscode relies on it, and ignores the "Python Path"…
stonebig
  • 1,193
  • 1
  • 9
  • 13
0
votes
1 answer

How to add or append python or PySpark modules to PYTHONPATH in Visual Studio Code

Two approaches to setup Pyspark in an IDE are : Using Pip i.e pip install pyspark , As mentioned in the following link ( E0401:Unable to import 'pyspark in VSCode in Windows 10) By appending PySpark modules in "PYTHONPATH" path, as mentioned in…
sumit kumar
  • 150
  • 1
  • 2
  • 13
-1
votes
1 answer

Installation error for PySCIPOpt in vscode Mac Ventura OS

I am working on a Mixed Interger Linear Programming problem. I wanted to use SCIP solver to find the optimised solution for my problem. I was trying to install "PySCIPOpt" package in vscode which resulted in the following error. error while running…
1 2 3
8
9