Python Forum
I use VsCode with Python and it currently won't let me run any code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I use VsCode with Python and it currently won't let me run any code
#1
I'm currently starting with Python, I use VsCode; Hadn't had any problems until yesterday.

Basically the problem is that I can execute individual lines of code (with "shift+Enter") and they work, but the moment I decide to execute all at once, I get an error

On the other hand, if I run all the code first, with the button that appears in the upper right corner of VsCode, the code runs fine; but if I try to execute individual lines of code (with "shift+Enter"), they work for me too, but when I re-execute all the code, I get the error

The sequence of how I do things goes like this:

  1. I open any file

  2. write something simple
    sentence_1="three sad tigers swallowed wheat in a wheat field"
    print(sentence_1)
  3. I execute line by line with "Shift+Enter" and in the terminal it comes out as it should
    "Shift+Enter" for sentence_1="three sad tigers swallowed wheat in a wheat field"
    >>sentence_1="three sad tigers swallowed wheat in a wheat field"
    "Shift+Enter" to print(sentence_1)
    >>three sad tigers swallowed wheat in a wheat field
  4. I try to Execute the complete code with the button that appears in the upper corner of VsCode, and in the terminal it appears
    Error:
    & C:/Users/LEROLERO/AppData/Local/Programs/Python/Python310/python.exe c:/Users/LEROLERO/Desktop/Untitled-1.py File "", line 1 & C:/Users/LEROLERO/AppData /Local/Programs/Python/Python310/python.exe c:/Users/LEROLERO/Desktop/Untitled-1.py ^ SyntaxError: invalid syntax
  5. In the problems tab Since I open the VsCode, I have this:
    Output:
    Missing module docstring Module name "Untitled-1" doesn't conform to snake_case naming style Constant name "sentence_1" doesn't conform to UPPER_CASE naming style Final newline missing
  6. The extensions I currently have installed are:
    • Python
    • Pylint
    • Pylance
    • Jupyter Keymap
    • Jupyte

  7. my status bar, where it is evident that I use Python 3.10.6 of 64Bits

Again, I insist that I would be infinitely grateful if you help me solve this problem that keeps my hands tied
Yoriz write Sep-18-2022, 03:14 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Attached Files

Thumbnail(s)
                   
Reply
#2
Turn it off and back on again. I have this happen occasionally with VSCode and a restart always clears it up for me,

If that doesn't fix things, look at the dropdown next to the arrow. What kind of run options do you have? Which one is selectected?
Reply
#3
Also, read this post: https://python-forum.io/thread-12237.html
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  writing and running code in vscode without saving it akbarza 1 344 Jan-11-2024, 02:59 PM
Last Post: deanhystad
  Python on VSCode GiBandoleiro 1 428 Nov-01-2023, 03:35 PM
Last Post: deanhystad
  Python package not seen in VSCode fmccabe80 6 3,080 Mar-06-2023, 10:01 PM
Last Post: fmccabe80
Photo A humble VsCode Python Snippets 2.0 medlexo 6 2,325 Jan-03-2022, 08:54 PM
Last Post: medlexo
  VSCode Setup and configuring to run with Python apollo 2 2,993 Jan-13-2021, 04:55 PM
Last Post: jefsummers
  How to connect Mysql databse with python and VSCode IDE madhusoodhananER 1 8,653 Oct-31-2019, 10:15 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020