I'm writing a Python script that can either be called as a Cron job or as a web page (i.e. as a CGI in response to an HTTP request). This is to process the mailboxes on my web server (to which I don't have command line access) to remove old messages. How do I find out whether the script has been called as a Cron job or as a CGI? I need to know this so I can format the output correctly, e.g. if this is a web request I need to start the output with "Content-type: text/html\n \n<html>", to do newlines by "<p>" or "<br>" etc.
Can I just access some header line which will always have a value in a web request, but which will be None if running from the command line or as a Cron job, or something similar? How? Thanks - Rowan -- http://mail.python.org/mailman/listinfo/python-list