microsoft / ptvsd

Python debugger package for use with Visual Studio and Visual Studio Code.
Other
548 stars 68 forks source link

"Exception has occurred" didn't pop up immediately #2110

Closed kzhui125 closed 4 years ago

kzhui125 commented 4 years ago

Environment data

VSCode 1.43.0 Python Extension 2020.2.64387 Python 3.7.5

import pandas as pd

def test1():
    # test
    df1 = pd.DataFrame({'a': [1, 1, 1, 2, 2, 2]})
    df2 = pd.DataFrame({'a': [1, 1, 1, 2, 2, 2, 2]})
    print('test1') # make breakpoint here or the next line
    # step over this line, "Exception has occurred" didn't pop up until breakpoint move to if statement
    df = df2[df1['a'].ge(0)] 
    print('test2')
    return False

def test2():
    if not test1():
        return False

    return True

while True:
    if test2():
        pass
    break

debug current python file, set breakpoint at line print test, step over:

Python debugging didn't pop up the error immediately, when I have a long file, it make me confuse.

karthiknadig commented 4 years ago

Do you have both these options ticked? image

kzhui125 commented 4 years ago

@karthiknadig thanks, "Raised Exceptions" is not ticked