PyWart: Exception error paths far too verbose

Rick Johnson rantingrickjohnson at gmail.com
Wed Jan 16 06:59:42 CET 2013


Python needs to trim the path to the source file from which the exception was caught and only display the relative path starting from your personal library folder. 

For example. Say your personal library exists in:

  C:\users\user\documents\python\lib

...then there is no need to post THAT portion of the path EVERY STINKING TIME! For instance, let's say a script at: 

  C:\users\user\documents\python\lib\sound\effects\echo.py

...throws an error. What will we see?

Traceback (most recent call last):
  File "C:\users\user\documents\python\lib\sound\effects\echo.py", line N, in BLAH

Why do i need to see "C:\users\user\documents\python\lib" EVERY time? 

Since all directories *BELOW* the directory that holds your personal Python library are /superfluous/ when posting exceptions to stderr, trimming this bloat can really help to make exception messages easier to read. 

Traceback (most recent call last):
  File "...\sound\effects\reverb.py", line XXX, in YYY



More information about the Python-list mailing list