Use IPython magic functions in ipdb shell
问题 When debugging Python script using ipdb my_script.py , I want to use IPython magic functions like %paste , %cd in ipdb debug session shell. Is is possible and how? 回答1: According to the ipdb Github repo magic IPython functions are not available. Fortunately, the IPython debugger provides a couple of clues of how to get this functionality without launching a separate IPython shell. Here is what I did to run %cpaste : ipdb> from IPython import get_ipython ipdb> shell = get_ipython() ipdb> shell