[Python] No way to quit IPython debugger's interactive mode in jupyterhub notebook

Discussão em 'Python' iniciado por Stack, Agosto 11, 2025.

  1. Stack

    Stack Membro Participativo

    So I import a module:

    from IPython.core.debugger import Pdb


    then I initiate an object for debugging:

    ipdb = Pdb()


    I define a function to test debug mode:

    def f(a=1):
    ipdb.set_trace()
    print(a)


    after I run the function:

    f()


    I am in the debug mode,in this mode I can quit easily with q,however,after I type

    interact


    to get in the interactive mode(be cause in this mode I can input multiple line code rather than one line code to run more complicated functional codes)

    I can't quit this mode unless I kill the whole python jupyter session(like kill the kernel), I have tried quit(),quit,q(),q,exit(),exit and ctrl+C and ctrl+D,None of them works.

    I checked the source code of the IPython.core.debugger module and didn't get helpful info.

    Anyone knows how to get out of this interactive session?

    Continue reading...

Compartilhe esta Página