ipdb icon indicating copy to clipboard operation
ipdb copied to clipboard

ipdb `with launch_ipdb_on_exception():` gives pylint E1129 error mesage

Open avatar-lavventura opened this issue 3 years ago • 10 comments

I am using: ipdb==0.13.9


For the code-block from answer for Launch an IPython shell on exception

from ipdb import launch_ipdb_on_exception

with launch_ipdb_on_exception():
    main()

I am getting following warning message: [not-context-manager] Context manager 'generator' doesn't implement __enter__ and __exit__. [E1129]

How could I prevent this warning message?

avatar-lavventura avatar Feb 20 '22 13:02 avatar-lavventura

Which versions of Python and IPython ?

gotcha avatar Feb 21 '22 13:02 gotcha

Python==3.8.10. I am not using IPython .

avatar-lavventura avatar Feb 21 '22 17:02 avatar-lavventura

Well, if you use ipdb, you use IPython because it is a dependency. Can you check which version has been installed ?

gotcha avatar Feb 23 '22 14:02 gotcha

I do not see that warning when running with Python 3.8.8 and IPython 8.0.1.

gotcha avatar Feb 23 '22 15:02 gotcha

Could it be related to pylint ?

see https://github.com/PyCQA/pylint/issues/782

gotcha avatar Feb 23 '22 15:02 gotcha

ipdb==0.13.9
pylint==2.12.2
```

`pip freeze | grep IPython` returns empty. 

avatar-lavventura avatar Feb 24 '22 12:02 avatar-lavventura

how did you install ipdb ? Are you in conda or jupyter or another environment ?

gotcha avatar Feb 24 '22 13:02 gotcha

The way I install pip install ipdb -U.

I am using just pure python, I am not using conda or jupyter or anything else.

I have os.environ["PYTHONBREAKPOINT"] = "0" in my python code and I just add breakpoint() # DEBUG into my code.

avatar-lavventura avatar Feb 28 '22 14:02 avatar-lavventura

When you install ipdb with pip like you describe above, it also installs IPython. Do you know how to check which version got installed ?

Do you use virtualenv or venv or bare python ?

gotcha avatar Mar 01 '22 10:03 gotcha

I am using venv, created as follows:

VENV=$HOME/venv
python3 -m venv $VENV
source $VENV/bin/activate

Ah there is ipython installed, I had not idea it exists.

$ ipython
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.27.0 -- An enhanced Interactive Python. Type '?' for help.

avatar-lavventura avatar Mar 02 '22 09:03 avatar-lavventura

Sorry for the delayed answer. I missed your post.

Did you try with a more recent IPython ?

pip install ipython==8.7.0 in your venv

gotcha avatar Dec 13 '22 14:12 gotcha

@avatar-lavventura Just for my information, did this actually solve your issue ?

Or you are being polite when I answered so late and you did not have a need for a solve anymore ?

gotcha avatar Dec 13 '22 23:12 gotcha

I was polite as well :) But when I asked the question I believe latest version for ipython was 7.27.0. When I updated the ipython version, it is solved my issue.

avatar-lavventura avatar Dec 16 '22 17:12 avatar-lavventura