[Baypiggies] Python SVG and CGI

Jeff Kunce jjkunce at gmail.com
Thu Jan 28 23:48:17 CET 2010


Here's a good basic tutorial on CGI with Python:
  http://gnosis.cx/publish/programming/feature_5min_python.html

A big gotcha for python CGI (especially serving binary data) is not running
the interpreter in "unbuffered mode" (-u startup option.)  An explanation
can be found at:
  http://www.imladris.com/Scripts/PythonForWindows.html
  (scroll down to the last section "Cross-platform shebang lines")

  -- Jeff


On Wed, Jan 27, 2010 at 8:23 PM, Andy Wiggin <andywiggin at gmail.com> wrote:

> On Wed, Jan 27, 2010 at 2:03 PM, Silas Toms <me at silastoms.com> wrote:
> > I’m trying to create a Python CGI application that will serve dynamically
> > generated SVG maps (mostly of parcel data generated using supplied GPS
> > coordinates) but I seem to be hitting the twin limitations of my (lack
> of)
> > knowledge of CGI and the sparseness of Python CGI documentation with
> regards
> > to the inclusion of SVG embeds or objects. Do any of you have any
> > information/documentation that you could point me towards?
> >
> > The whole thing is so frustrating because this seems really promising,
> and I
> > feel like I’m so close to creating something really useful.
> >
> > PS I’m more of a GIS guy so even the most basic info might be what I
> need.
>
> Silas,
> I haven't done quite you're trying to do, but I have served SVG files
> from a web server. In the spirit of offering you the most basic info,
> I have two tips, both of which you may already know. The Internet
> Explorer web browser is not too friendly towards SVG, so if you're
> testing with IE, it could be part of your problem. Second is that when
> your CGI script services the request for the SVG file, you probably
> have to set the content type correctly. Modifying the example from the
> Python CGI module docs, you would want something like:
>
> print "Content-Type: image/svg+xml"
> print                               # blank line, end of headers
>
> -Andy
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20100128/05cb100f/attachment.htm>


More information about the Baypiggies mailing list