microsoft/ptvsd

"Exception has occurred" didn't pop up immediately

kzhui125 opened this issue · 2 comments

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.

Do you have both these options ticked?
image

@karthiknadig thanks, "Raised Exceptions" is not ticked