On Tue, 15 Jan 2013 21:59:42 -0800, Rick Johnson wrote: > 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.
What personal library folder? > For example. Say your personal library exists in: > > C:\users\user\documents\python\lib I have Python scripts in my home directory: /home/steve/ and in a python subdirectory: /home/steve/python and in site packages: /usr/lib/python2.4/site-packages/ /usr/local/lib/python2.5/site-packages/ /usr/local/lib/python2.6/site-packages/ /usr/local/lib/python2.7/site-packages/ /usr/local/lib/python3.2/site-packages/ /usr/local/lib/python3.3/site-packages/ and to my shame on my Desktop, the bane of my life (can't live with it, can't live without it): /home/steve/Desktop and in my scripts directory: /home/steve/scripts So, which of those directories is my personal library? > Since all directories *BELOW* the directory that holds your personal > Python library are /superfluous/ when posting exceptions to stderr, I think you mean "above". The root is at the top of the directory tree, not the bottom. /a/b/c c is below b, which is below a. > 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 There is a difference between "less words to read" and "more helpful". Professional programmers do not have the luxury of only working in their comfortable, personal computer. Often they are called in to fix a problem with other people's programs: customers and clients. It would be a real PITA to be working on an unfamiliar program on an unfamiliar system and be faced with a error message like that. *Especially* if you then search for a file reverb.py and get results like: C:\Documents\python\sound\effects\reverb.py C:\users\george\My Documents\sound\effects\reverb.py C:\users\susan\programming\python\lib\sound\effects\reverb.py E:\Temp\sound\effects\reverb.py F:\Development\python\lib\music\sound\effects\reverb.py G:\app-dev\sound\effects\reverb.py Printing the full path is harmless when you already know which directory the file is, because you can skim over the path and just pay attention to the file name. If you don't know which directory the file is in, printing the full path is essential. On the other hand, abbreviating the path gains you practically nothing when you know where the file is, and costs you a lot when you don't. -- Steven -- http://mail.python.org/mailman/listinfo/python-list