handler clause, and they display the exception’s message—fetched using Python’s
sys.exc_info—to give additional context. Figure 15-32 shows one such error page.
Figure 15-31. Accessing private files
Figure 15-32. File errors display
As a general rule of thumb, file-processing exceptions should always be reported in
detail, especially during script debugging. If we catch such exceptions in our scripts,
it’s up to us to display the details (assigning sys.stderr to sys.stdout won’t help if
Python doesn’t print an error message). The current exception’s type, data, and trace-
back objects are always available in the sys module for manual display.
Do not install the getfile.py script if you truly wish to keep your files
private! The private files list check it uses attempts to prevent the en-
cryption module from being viewed directly with this script, but it may
or may not handle all possible attempts, especially on Windows. This
book isn’t about security, so we won’t go into further details here, except
to say that on the Internet, a little paranoia is often a good thing. Espe-
cially for systems installed on the general Internet at large, you should
generally assume that the worst case scenario might eventually happen.
Transferring Files to Clients and Servers | 1217