Hmm. When I try this on the one 0.9.9 frozen script I have lying
around, all it does is print nothing (as I would expect) for files it
cannot find. It doesn't print garbage and it doesn't hang. If it
really *hangs*, I suggest you have a closer look at your system to see
why. The stack traceback printing code is fairly robust as far as I
can remember.
One detail you may not know: if it can't open the filename as found in
the code object, it searches sys.path for the basename. This vastly
increases the chance of finding the file (e.g. when the code object
contains a relative filename) but might cause confusion if your script
was frozen from a different version than the version in finds along
$PYTHONPATH. Finally, note that the source is not included in the
frozen binary.
Perhaps it would be better not to attempt to print lines from the file
at all for frozen modules?
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>