cgi - push a page from a select menu

TMGB bennettt at am.appstate.edu
Sun Jul 18 22:44:59 EDT 1999


I am trying to use python to receive a url from a form select menu and
then send that page back to the browser.  All three of my attempts so
far leave this error message on the web server: 

[18/Jul/1999:22:06:34] failure: for host ....library.appstate.edu trying
to POST /CGI-NT_Python/goto.pyc, cgi-parse-output reports: the CGI
program D:\...(path to python)\Python\python.exe did not produce a valid
header (program terminated without a valid CGI header (check for core
dump or other abnormal termination) 

I also get this on a web page for the third attempt: AttributeError:
open_http 

The python paths are correct, I have another python form using these
paths.  I would think that the urllib would send the url requested with
its header( if I use it correctly).  I tried printing a header and still
get this error.  The URL of the page with the selector is:

http://www.library.appstate.edu/saat/forms/test/


# Author: Thomas McMillan Grant Bennett
# webmaster at www.library.appstate.edu
# Python script to accept a url from a form and go to that URL
# Filename: goto.py

import cgi
import urllib

form = cgi.FieldStorage()
form_ok = 0
if form.has_key("select"):

# third attempt
#   html_page=urllib.open_http(form["select"].value)
#   print html_page

# second attempt  
#   html_page=urllib.urlretrieve(form["select"].value)
#   print html_page

# first attempt
#   print(read(urllib.urlopen(form["select"].value)))
   


----------------------------------------------------------------------
Thomas McMillan Grant Bennett           Appalachian State University
Computer Consultant II                  University Library
bennettt at am.appstate.edu               
http://www.library.appstate.edu/admin/
Voice:  828 262 6587			FAX:    828 262 3001

Windows 95 is a 32-bit extension to a 16-bit patch for an 8-bit
operating system that was originally coded for a 4-bit microprocessor.
 - Chris Dunphy     Boot Magazine




More information about the Python-list mailing list