43

Does anyone know how to break on unhandled exceptions in pycharm? per this link it should be possible, although its not breaking for me (build 105.58). Is there some switch I have to turn on to enable this?

EDIT: I did what you suggested, but the debugger is not breaking on unhandled exceptions. Please see the screenshot below, and let me know if I need to do something else. enter image description here

It seems this is the same issue as breaking on unhandled exceptions in pydev/gae. Pycharm uses pydevd for the debugger.

C:\Python25\python.exe "C:\Program Files\JetBrains\PyCharm 1.2.1\helpers\pydev\pydevd.py" --client 127.0.0.1 --port 49371 --file C:/Users/morpheus/PycharmProjects/untitled1/main.py
pydev debugger: warning: psyco not available for speedups (the debugger will still work correctly, but a bit slower)
pydev debugger: starting
Connected to pydev debugger (build 105.58)

I can get it to break on a non-gae project, but it won't break on a gae project. How can this be fixed?

Community
  • 1
  • 1
morpheus
  • 18,676
  • 24
  • 96
  • 159

2 Answers2

38

Please check the documentation:

To create an exception breakpoint

  1. On the main menu, choose Run | View Breakpoints, or press Ctrl+Shift+F8.
  2. Select the Exception Breakpoints tab.
  3. Click Add button.
  4. In the Enter Exception Class dialog, specify the desired exception class from the library, or from the project, and click OK.
CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Could you perhaps elaborate on what exactly an `Exception Class Dialog` means, and how this might actually work? Is this simply the string that an exception throws? – Derek Adair Nov 01 '12 at 20:17
  • @DerekAdair, it [opens a dialog](http://img32.imageshack.us/img32/9751/20121102044459.png) where you can select the class name, it's just a string representing the name of the class. – CrazyCoder Nov 02 '12 at 00:45
  • 5
    At least in PyCharm 3.4, this does not work unless you're willing to suspend every time the exception is raised, whether it's caught or not. – Peter Oct 02 '14 at 17:19
  • How do you toggle that setting, @Peter? – hlin117 Jan 08 '15 at 02:37
  • Recent versions of PyCharm break on exceptions by default. The setting is now in a checkbox in a tree list in the Run/View Breakpoints. – Josep Valls Apr 09 '16 at 22:31
  • 1
    Can anyone suggest why that option toggled itself in my project? – Atcold Feb 23 '17 at 14:55
6

Now on Pycharm 5(at least) you can make it break on unhandled exceptions by checking "all exception" and "on terminate".

maazza
  • 7,016
  • 15
  • 63
  • 96