Memo‎ > ‎

Let matplotlib.pyplot.show() to pause with pydev

posted Aug 23, 2019, 7:29 PM by Teng-Yok Lee
After matplotlib.pyplot.show(), add the following to pause the script:
 
    try:
        # This is to pause the script
        # when debugging with PyDev.
        # It should be put after plt.show()
        # so it will be only executed in debug mode.
        import pydevd;
        dummy_fig = plt.figure();
        dummy_fig.canvas.start_event_loop_default();
    except:
        pass;

Comments