rich icon indicating copy to clipboard operation
rich copied to clipboard

Support pyinstaller relative paths in Traceback (#2251)

Open gormaniac opened this issue 3 years ago • 1 comments

Type of changes

  • [X] Bug fix

Checklist

  • [x] I've run the latest black with default args on new code.
  • [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • [ ] I've added tests for new code.
  • [x] I accept that @willmcgugan may be pedantic in the code review.

Description

In rich.traceback.Traceback.extract, if frame_summary.f_code.co_filename isn't an absolute path, we now check if we're running in a pyinstaller bundle, and will fabricate a file name to avoid errors. See #2251 for details.

gormaniac avatar May 04 '22 20:05 gormaniac

Struggling to mock a traceback for a test. We can't just use one from sys.exc_info as we wouldn't hit the new code, we need a relative path. All of the attributes we need on a traceback are read only.

gormaniac avatar May 04 '22 20:05 gormaniac

Closing. Assumed stale. Feel free to reopen if you want to continue work on it.

willmcgugan avatar Sep 19 '22 09:09 willmcgugan