[Python-Dev] Re: cgitb.py for Python 2.2

Guido van Rossum guido@zope.com
Tue, 31 Jul 2001 23:06:14 -0400


> On Tue, 31 Jul 2001, Guido van Rossum wrote:
> > Why not add this to cgi.py instead?
> 
> Because that would seem to defeat most of the point.
> 
> The point was to provide an instant, effortless improvement for all
> of the Python CGI scripts out there.  If programmers have to manually
> edit all of their CGI scripts to insert
> 
>     import sys, cgitb
>     sys.excepthook = cgitb.excepthook
> 
> then it's just as annoying as inserting
> 
>     import sys
>     sys.stderr = sys.stdout
> 
> I don't want people to have to edit every single script.

You misunderstand.  You proposed a few lines that would automatically
do this in site.py, which is always imported.  I propose to add those
same lines to cgi.py, so that any code that imports cgi.py
*automatically* has he feature enabled.  I assume that all CGI scripts
have an import of cgi.  There are non-CGI scripts that import cgi, but
those will be protected by the check for an environment variable that
you propose.

> > I don't like new additions that are
> > irrelevant for most apps (CGI is a tiny niche for Python IMO).
> 
> I think this is where our perceptions differ.  I think of CGI as
> the application that totally "made" Perl, and as the quickest, easiest
> way that many beginners get early payoff from a scripting language.

Yeah.  But it's not doing that for Python IMO.  Most Python apps (even
those that do web stuff) are not CGI apps.

> My impression is that it has been a big "hook" for bringing people to
> Perl and Python -- it's the shortest path to building and deploying
> something useful to a huge and unlimited audience.
> 
> Wouldn't you say there are more Python CGI programmers out there
> than, say, Zope developers?  Or think of it like this: what fraction
> of Web developers are CGI programmers, and what fraction of those
> use Python?

I don't want Python to become a wannabe CGI language, and I don't want
to make choices that benefit CGI programmers to the detriment of
others (CGI is actually a pretty lame way of producing active web
content).  Python is a decent language for CGI, but Perl is the
established standard and then there's PHP which also has way more
users than Python.

> Maybe i'm wrong?  I welcome more opinions from others -- how do you
> see people coming to Python?  What's the first "real" thing they do
> with Python that motivates them to try it?

All sorts of stuff.  Using NumPy.  GUI apps.  Database apps.  Unix
scripting.  App steering.

--Guido van Rossum (home page: http://www.python.org/~guido/)