SystemError: error return without exception set, when using requests and debugger

Python 3.xPython RequestsPycharm

Python 3.x Problem Overview


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?

Python 3.x Solutions


Solution 1 - Python 3.x

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.

Solution 2 - Python 3.x

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'),

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCodeSamurai777View Question on Stackoverflow
Solution 1 - Python 3.xGuidoView Answer on Stackoverflow
Solution 2 - Python 3.xuser2662404View Answer on Stackoverflow