Downloading Python files

Bengt Richter bokr at
Fri Jul 25 20:00:03 CEST 2003

On Fri, 25 Jul 2003 15:26:49 +0000 (UTC), Luke StClair <luke at> wrote:

>Only marginally belonging in this newsgroup... but oh well.
>I've just started writing in python, and I want to make the files
>available on the web.  So I did the standard <a
>href="mypath/"> and not surprisingly, it displays like a
>webpage, but just the code.  If I gzip it, and then link to the new
>file, it will download, but its so small I don't want it zipped.  
>How can I make this into a downloadable
>file SIMPLY?  The other thread seems a bit complicated...
If the user has .py set up for automatic shell execution of .py files, the browser
should warn of security risk and provide an option to save to disk. If the user doesn't,
then it may show as text as you describe. If that's already happened, s/he should be
able to do file>save as ... and save as a .py file somewhere. If the user is still
looking at your page with the highlighted link, s/he should be able to right-click the link
and get an option to "save link as ..." You could just tell the user about that
in association with your link(s), e.g., with the following (untested!) HTML:

Right-click <a href="mypath/">this</a> to save to disk.<br>
Left-click <a href="mypath/">this</a> to open according to your browser settings.

Note that it's really the same link, just different instructions.
I guess for different browsers YMMV.

Bengt Richter

More information about the Python-list mailing list