Newbie has question that's not exactly Python...

Ken Seehof kens at sightreader.com
Mon Apr 2 18:57:46 EDT 2001


----- Original Message -----
From: "Gary Walker" <borealis3 at home.com>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Monday, April 02, 2001 2:40 PM
Subject: Newbie has question that's not exactly Python...


> But since I'm learning Python, I'd like to post it here, and hope someone
> will post some example code in Python...
>
> Background: I'm excited by the object oriented simplicity Python offers;
I'm
> a Delphi programmer by day, and it's the similar exception handling,
object
> creating, etc. that I really dig, not to mention PIL, the Python Imaging
> Library.  I'm also jazzed by the web, and so Python seemed a natural
choice
> for a new language to pick up...
>
> Here's the question:
>
> When a web app needs to produce an image, it's usually a trivial task:
> simply reference the image in the HTML code, and voila.
>
> How does one go about producing a dynamically generated image? That is to
> say, one that didn't exist until the python script ran? I hope I don't
have
> to save it to some tempfile, and reference *that* in my python code.

Why not?

> Thinking aloud here:
> Ideally, one would reference a SCRIPT instead of an image, and the script
> would return the image to the, the... page??

Yes, you can write an http request handler that can return an image as a
string
(a raw binary string, that is).  Actually, it would probably be simpler to
just
make the handler save the image as a file in a temp directory and return it
as
a file.

> Can anyone provide a really simple example of how I'd go about something
> like this??

Not really, you need to learn medusa first.  Actually you should learn
python
first, then medusa.  This probably shouldn't be your very first project. :-)

> Does this question make sense?? I know what I'm *trying* to say here, but
I
> might not be succeeding at saying it... :)

Makes sense to me.

> TIA,
>
> Gary Walker
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>





More information about the Python-list mailing list