Python debugger does not work for some installed packages
I have the following project structure:
common
avro_utils
my_test.py
I also have avro-python3 v.1.8.2 installed.
my_test.py imports avro modules in this way:
import avro
from avro.io import AvroTypeException
from avro.schema import RecordSchema
I'm trying to debug internals of avro.io. However, any breakpoints I set in either avro/io.py or avro/__init__.py do not work. "Step Into" (F7) does not work either. Both breakpoints and "Step Into" work on other modules, including standard library modules (I tried e.g. with unittest).
The only way I managed to make debugging work was by copying avro/io.py to avro/io1.py and importing the latter instead of io.py.
I tried invalidating IntelliJ Idea cache several times. Also tried removing avro/__pycache__ folder.
The code of the avro modules is definitely executed because when I add print() traces inside, I can see them - but breakpoints still don't work. Occasionally, when I make changes in avro/__init__.py, breakpoints start working there, but after another change - magically stop again. Seems to have no correlation with whether it matches the original file or not. None of these experiments made avro/io.py work.
Please sign in to leave a comment.
I use IntelliJ Idea Ultimate 2019.3.2 with Python plugin 193.6015.41.
Didn't reproduce for me, I've installed avro 1.9.1 for python 2 and breakpoints work inside avro/io.py
Can you provide more details? Specifically:
- Your version of avro?
- Where did you place the breakpoint and which code do you run to reproduce the issue?
This may be obvious, but make sure that:
1. "Attach to subprocess automatically" is enabled in [File | Settings | Build, Execution, Deployment | Python Debugger]
2. Both "Do not step" checkboxes are disabled for Python in [File | Settings | Build, Execution, Deployment | Debugger | Stepping]
I have avro v.1.8.2 as I wrote in the original post. But I think I tried 1.9.1 and had the same problem.
I guess all debugger settings were fine, because debugging worked perfectly for a copy of avro/io.py in the same directory. Please see the details in the original description.
I wonder if this can be related to a similar issue I reported last year: https://intellij-support.jetbrains.com/hc/en-us/requests/2320026
At the time, Tonya replied that it's a known bug and a fix would be released later.