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?

9
  • Does something here help? Commented May 16, 2018 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. Commented May 16, 2018 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. Commented May 16, 2018 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. Commented May 16, 2018 at 12:11
  • 2
    same problem, but the code runs perfectly.. Commented May 27, 2018 at 20:43

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

9 Comments

The guys at jetbtains suggested the same fix but it did not work for me
Worked for me pretty well, I set it up in Debug configuration environment variables
Worked for me as well (Python 3.7; PyCharm 2019.1.2 CE)
Worked also in PyCharm 2019 1.2 Ultimate . Is it possible to add that to env var's for all run configurations by default?
I guess you can, you can just set environment variables (also outside of PyCharm).
|
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'),

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.