54

Environment: Python 3.6.3 Requests 2.18.4 PyCharm 2018.1

When using the above configuration in normal run everything is fine. However,when using PyCharm debugger my output is constantly giving me two kinds of exceptions:

Exception ignored in: <generator object urlsplit.<locals>.<genexpr> at 0x7f69803940a0>
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/parse.py", line 433, in <genexpr>
    if not rest or any(c not in '0123456789' for c in rest):

or

SystemError: error return without exception set
Exception ignored in: <generator object iter_slices at 0x7f69803940f8>
Traceback (most recent call last):
  File "/home/damian/workspace/DofusV2/venv/lib/python3.6/site-packages/requests/utils.py", line 449, in iter_slices
    def iter_slices(string, slice_length):
`

This is not an issue in a single project, I had this issue in numerous projects countless times. However, every project was multi-threaded ( I do not know if this makes any difference) The thing is I do not have this problem when not using the debugger plus it doesn't really do anything the application is stable and works fine. My question is why is this happening and can I at least suppress it so it won't pollute my log?

CodeSamurai777
  • 3,285
  • 2
  • 24
  • 42
  • Does something [here](https://stackoverflow.com/questions/38036540/what-type-of-message-exception-ignored-in-is) help? – MegaIng May 16 '18 at 11:55
  • 2
    Not really, it only states that the problem maybe due to generator object being destroyed, does not say how to resolve the issue. Plus my problem only occurs when using debugger. – CodeSamurai777 May 16 '18 at 12:03
  • Yes, the question (and the linked one) to propose solutions. Don't raise Exceptions while Generator cleanup. We can not help you if you don't give code. I thing it only occurs while debugging because the debugger makes more explicit cleanup. – MegaIng May 16 '18 at 12:07
  • That could be it, did not think that debugger could work like this. However, as you can see the error occurs in library files which I do not control, so I cannot change that behavior plus I do not know which lines from the project would be relevant to the issue as this is all the traceback info I've got. – CodeSamurai777 May 16 '18 at 12:11
  • 2
    same problem, but the code runs perfectly.. – Sean Stayns May 27 '18 at 20:43
  • Same problem here as well, I just updated PyCharm to 2018.1 and python to 3.7, before I used the debugger in the same project many many times and never got this error, while now I keep getting it no matter what I type in the debugger console. I think it might be a bug with the latest PyCharm version – Euler_Salter Jul 04 '18 at 12:09
  • I posted the problem on the PyCharm issue tracker and they are looking into it – CodeSamurai777 Jul 27 '18 at 11:14
  • Just chiming in to say I had this problem also (posted about it here: https://stackoverflow.com/questions/48410264/pycharm-debug-mode-throws-fake-errors-but-runs-normally-when-not-in-debug). I didn't find a solution other than rolling back my PyCharm version. Note I am using Python 2.7 though, not 3.x – MKF Oct 26 '18 at 20:33
  • Same here, working with Django server and Python 3.6, I get the same error only in debug mode, the proposed solution did not work for me – Nicolò Gasparini Dec 12 '18 at 13:10

2 Answers2

77

I had a similar problem when using Gensim Word2vec models, also using debugger in Python 3.6 / PyCharm 2018.2. Just as a quick fix, I found a solution by setting an environment variable:

PYDEVD_USE_FRAME_EVAL=NO

This can be done easily in PyCharm by settings environment variables in PyCharm run configuration. After setting this variable, I could use debugger again. More info can be found here and here.

Guido
  • 6,182
  • 1
  • 29
  • 50
0

Just in case it helps other googlers, in Pycharm 2019 I found I'd caused this error by using a line in my urlpatterns:

# including this line caused the error (I wanted to catch the 'my_special_model' type and use the general one below for other models.  
    path('display/my_special_model/<int:item_id>/', views.display_model, name='display_model'),

# This works fine ... 
    path('display/<item_type>/<int:item_id>/', views.display, name='display'),