vscode-python: Code doesn't run at all after pressing Run button

Type: Bug

Test code I was attempting to run:

class Account:
    def __init__(self, name, balance, password):
        self.name = name
        self.balance = balance
        self.password = password
    
    def deposit(self, amountToDeposit, password):
        if password != self.password:
            print("Incorrect password")
            return None
        else:
            if amountToDeposit < 0:
                print("You cannot deposit an amount below 0")
                return None
            else:
                self.balance += amountToDeposit
    
    def withdraw(self, amountToWithdraw, password):
        if password != self.password:
            print("Incorrect password")
            return None
        else:
            if amountToWithdraw < 0:
                print("You cannot withdraw an amount below 0")
                return None
            else:
                if amountToWithdraw > self.balance:
                    print("You cannot withdraw more than what you have in your account")
                    return None
                else:
                    self.balance -= amountToWithdraw
                    return self.balance
    
    def getBalance(self, password):
        if password != self.password:
            print("Incorrect password")
            return None
        else:
            return self.balance
    
    def show(self):
        print(f"""Name: {self.name}
Balance: {self.balance}
Password: {self.password}""")

acc = Account('John', 1000, 'JohnPassword')
acc.show()
acc.withdraw(100, 'JohnPassword')
acc.deposit(200, 'JohnPassword')
acc.getBalance('JohnPassword')
acc.show()

Expected Results:

Name: John
Balance: 1000
Password: JohnPassword
Name: John
Balance: 1100
Password: JohnPassword

Actual Results:

None of the code seems to get runned, the terminal doesnt pop up automatically and using Ctrl + ` to bring it up shows that nothing changed there either.

I attempted this using the Run button and I also tried to delete and reinstall Python and VSCode to see if that would fix the issue. I also tried reinstalling Python from the Microsoft Store rather than the web, but none of these solutions worked.

Extensions I have installed: Pylance Python SQLite Remote Repositories (temp closed by Extension Bisect) Azure Repos (linked to Remote Repositories, so is also closed) GitHub Repositories (linked to Remote Repositories, so is also closed)

Extension version: 2023.14.0 VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:22:42.175Z) OS version: Windows_NT x64 10.0.22621 Modes:

System Info
Item Value
CPUs Intel® Celeron® N4000 CPU @ 1.10GHz (2 x 1094)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: disabled_off
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 3.83GB (0.32GB free)
Process Argv –crash-reporter-id 1bb5e6bc-98e6-489c-a47e-a7a6a5ac9c56
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes516:30244333
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
vscccc:30803845
282f8724:30602487
f6dab269:30613381
a9j8j154:30646983
showlangstatbar:30737416
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
dsvsc013:30795093
dsvsc014:30804076
diffeditorv2:30821572

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

You too, glad to know it helped!