Veeeeery Basic Question

Cameron Laird claird at starbase.neosoft.com
Mon Feb 28 09:44:30 EST 2000


In article <38b99975.2288717 at news.mindspring.com>,
Eric Stewart <ericstewart at mindspring.com> wrote:
>I'm writing my first script....ever.  I just finished _Learning
>Python_ by Lutz.
>
>Here's what I want to do:
>Iterate over a series of image files in a given directory.
>Randomly select one on those files 
>Post that file to a web site.
>
>Each time you hit the web site you will see a different randomly
>selected image.
>
>I guess this will be a CGI script that will run in the Directory
>cgi-bin, which will be referenced by the HTML.
>
>The image files which i will select from will be in a seperate
>directory, i.e C:Web Stuff\Images
			.
			.
			.
Fredrik addresses the Python aspects quite well,
of course.

If this is a serious development for you, there
are at least a couple more questions you'll do
well to consider before coding.

>From your description, it sounds as though your
plan is that every access of the URL will cause
an image to be copied from a staging (?) host
across a network to a Web service host.  If that's
what you want, and it works for you, so much the
better.  My personal reaction to that is that it's
seriously susceptible to a bottleneck in the stag-
ing-to-Webserver network bandwidth.  Moreover, a
very, very common computing idiom is likely to
multiply your performance by many orders of magni-
tude.  Are you familiar with "indirection"?
There's likely to be a convenient way for you to
randomize selection of a pointer to an image,
rather than randomize the operation of copying an
image around.

Also, to be precise, while CGI might well be the
mechanism you choose for this exercise, it doesn't
have to be.  Your description leaves me wondering
whether you understand there are alternatives.
-- 

Cameron Laird <claird at NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list