almost immediately after writing the languages source code viewer script in the preceding exampleit occurred to me that it wouldn' be much more workand would be much more usefulto write generic version--one that could use passed-in filename to display any file on the site it' straightforward mutation on the server sidewe merely need to allow filename to be passed in as an input the getfile py python script in example - implements this generalization it assumes the filename is either typed into web page form or appended to the end of the url as parameter remember that python' cgi module handles both cases transparentlyso there is no code in this script that notices any difference example - pp \internet\web\cgi-bin\getfile py #!/usr/bin/python ""#################################################################################display any cgi (or otherserver-side file without running it the filename can be passed in url param or form field (use "localhostas the server if local)users can cut-and-paste or "view sourceto save file locally on ierunning the text/plain version (formatted=falsesometimes pops up notepadbut end-lines are not always in dos formatnetscape shows the text correctly in the browser page instead sending the file in text/html mode works on both browsers--text is displayed in the browser response page correctly we also check the filename here to try to avoid showing private filesthis may or may not prevent access to such files in generaldon' install this script if you can' otherwise secure source#################################################################################""import cgiossys formatted true privates ['pymailcgi/cgi-bin/secret py'trysamefile os path samefile exceptdef samefile(path path )apath os path abspath(path lower(apath os path abspath(path lower(return apath =apath true=wrap text in html don' show these checks deviceinode numbers not available on windows do close approximation normalizes pathsame case html ""getfile response source code for'% % ""transferring files to clients and servers