Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I turn off the "Evaluating: plt.show() did not finish after 3.00s seconds." warning in the VsCode debugger?

I often debug my python code by plotting NumPy arrays in the vscode debugger. Often I spend more than 3s looking at a plot. When I do vscode prints the extremely long warning below. It's very annoying because I then have to scroll up a lot all the time to see previous debugging outputs. Where is this PYDEVD_WARN_EVALUATION_TIMEOUT variable? How do I turn this off?

I included the warning below for completeness, thanks a lot for your help!

Evaluating: plt.show() did not finish after 3.00s seconds. This may mean a number of things:

  • This evaluation is really slow and this is expected. In this case it's possible to silence this error by raising the timeout, setting the PYDEVD_WARN_EVALUATION_TIMEOUT environment variable to a bigger value.

  • The evaluation may need other threads running while it's running: In this case, it's possible to set the PYDEVD_UNBLOCK_THREADS_TIMEOUT environment variable so that if after a given timeout an evaluation doesn't finish, other threads are unblocked or you can manually resume all threads.

    Alternatively, it's also possible to skip breaking on a particular thread by setting a pydev_do_not_trace = True attribute in the related threading.Thread instance (if some thread should always be running and no breakpoints are expected to be hit in it).

  • The evaluation is deadlocked: In this case you may set the PYDEVD_THREAD_DUMP_ON_WARN_EVALUATION_TIMEOUT environment variable to true so that a thread dump is shown along with this message and optionally, set the PYDEVD_INTERRUPT_THREAD_TIMEOUT to some value so that the debugger tries to interrupt the evaluation (if possible) when this happens.

like image 911
v0lta Avatar asked Dec 01 '20 15:12

v0lta


1 Answers

If found a way to adapt the launch.json which takes care of this problem.

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "env": {"DISPLAY":":1",
                    "PYTHONPATH": "${workspaceRoot}",
                    "PYDEVD_WARN_EVALUATION_TIMEOUT": "500"},
            "cwd": "${workspaceFolder}",
            "console": "integratedTerminal"
        }
    ]
}
like image 191
v0lta Avatar answered Oct 06 '22 22:10

v0lta