How use urllib.urlopen()?
pbjorn at uswest.net
Fri Dec 22 19:38:29 CET 2000
print "Content-type: text/html"
then your program. If that doesn't work, try:
- make sure the script is executable
- change the extension of your script to .cgi
If none of that works try the following:
- put the following in tt.cgi
- make tt.cgi executable
- create yyy.txt and make it world writable (important)
- run it from your web-browser
- look at what went wrong (it should be in yyy.txt).
echo "Content-type: text/html"
/home/bjorn/public_html/xxx.py >> yyy.txt 2>&1
#echo "<h1>hello world</h1>"
Hope this gets you on your way.
Gustaf Liljegren wrote:
> Can't get the urlopen() function to work. I have a script on a UNIX web
> server that should go to another webpage when the user clicks a button. To
> isolate the problem, I made a test script:
> import urllib
> u = urllib.urlopen("http://www.yahoo.com")
> print u.read()
> When running this I get HTTP 500 - Internal server error. :-(
> What's missing?
More information about the Python-list