CGI Scripts

Steve Holden sholden at bellatlantic.net
Tue Feb 8 13:48:27 CET 2000


Have you viewed the HTML source of your generated page?
It's possible the output from your script is appearing
somewhere other than inline, in which case your code
might actually be running but the browser may not be rendering
the output.

regards
 Steve

Robert Rutkowski wrote:
> 
> I'm new to programing and in an effort to learn python, I'm trying to write
> a simple text counter. The script is called with an SSI exec command. The
> path on my server is correct and the script appears to work. I receive no
> errors, and the script runs just fine locally on my machine.
> My problem is that the script returns a result via the print command. {print
> `count()`}, but when I try to run the script on my server, I get no results,
> just a blank page.
> Am I missing something? Is there a module that I need to pass the result to
> to see it in my web browser.
> 
> -----------------------------------------------------
> #!/usr/contrib/bin/python
> 
> #Python Counter Script
> 
> import cgi
> import string
> 
> def count():
>     count = open('counter.log', 'r+')
>     strhits = count.read()
>     hits = string.atoi(strhits)
>     hits = hits+1
>     count.seek(0, 0)
>     count.write(`hits`)
>     count.close()
>     return hits
> 
> print "Content-type: text/html"
> print
> print `count()`
> ------------------------------------------------



More information about the Python-list mailing list