You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One workaround is to manually edit the distutils/setuptools/etc. source code and add a pdb.set_trace() closer to the code you wish to debug (so that PDB is not invoked until after this sys.stdout switcheroo).
Some other possibilities might be to monkeypatch distutils.dist to replace the print() function (this all only applies to Python 3 anyways IIUC) or alternatively pdb can be monkeypatched. The code the messes with sys.stdout could be rewritten as a context manager that handles this.
It's probably not worth it though since this is indeed a narrow corner case. But if you would accept such a patch I'll think about writing it. In the meantime just thought I'd document the issue.
Original comment byjaraco (Bitbucket: jaraco, GitHub: jaraco):
I've run into this issue myself. Thanks for writing up the details and your research. I'd like a better experience, so if you're interested in pursuing a patch, I'd be eager to see it.
Originally reported by: embray (Bitbucket: embray, GitHub: embray)
I ran across this while trying to run
on Windows, in a standard cmd.exe prompt, while trying to debug an unrelated issue.
This results in a traceback stemming from Pdb ending with:
the full traceback isn't really important. This traces back to https://bitbucket.org/tarek/distribute/issues/311 -- because the original
sys.stdout
's raw buffer is detached, Pdb breaks. https://bitbucket.org/tarek/distribute/issues/334 added a partial workaround, but it's acknowledge there that there may be corner cases not covered. This is one such corner case.One workaround is to manually edit the distutils/setuptools/etc. source code and add a
pdb.set_trace()
closer to the code you wish to debug (so that PDB is not invoked until after thissys.stdout
switcheroo).Some other possibilities might be to monkeypatch
distutils.dist
to replace theprint()
function (this all only applies to Python 3 anyways IIUC) or alternatively pdb can be monkeypatched. The code the messes withsys.stdout
could be rewritten as a context manager that handles this.It's probably not worth it though since this is indeed a narrow corner case. But if you would accept such a patch I'll think about writing it. In the meantime just thought I'd document the issue.
The text was updated successfully, but these errors were encountered: