I'm so tired of this ...
Well, pdb: set a breakpoint on file which isn't in sys.path says:
According to this answer you can also set a break point by writing the full path to filename
And I've even tried it once before, and it worked.
And now I'm trying to debug another script:
$ python3 -m pdb freeze.py
> c:/tmp/mytest/freeze.py(9)<module>()
-> import py2exe
(Pdb) n
> c:/tmp/mytest/freeze.py(10)<module>()
-> from py2exe import freeze
(Pdb) b /mingw64/lib/python3.11/site-packages/py2exe/runtime.py:166
End of file
(Pdb) b
(Pdb)
And just to show that file, and line 166, exists:
$ awk 'NR >= 165 && NR <= 167 {printf "%d\t%s\n", NR, $0}' /mingw64/lib/python3.11/site-packages/py2exe/runtime.py
165 def analyze(self):
166 logger.info("Analyzing the code")
167
What is the problem? Why cannot I set a breakpoint and I get "End of file" instead? How do I set the breakpoint properly so it works?
Right, found that error message here: https://github.com/python/cpython/blob/a50cf6c/Lib/pdb.py#L1084 :
... so the problem is with
linecache.getline.Now, here I am using the MINGW64 Python3 under Windows 10; MINGW64
bashshell typically accepts linux-style paths - but it turns out, Python3 (or at leastlinecache) does not - from withnpdb:So, apparently I needed to specify the full path with a Windows drive prefix (
C:), just the Linux-style full path does not work:Now, there remains the problem that the breakpoint does not hit even though I see the output of the corresponding line ("Analyzing the code") printed - but that is another issue ...