How use urllib.urlopen()?
Bjorn Pettersen
pbjorn at uswest.net
Fri Dec 22 13:38:29 EST 2000
Try:
#! /usr/local/bin/python
print "Content-type: text/html"
print
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).
#!/bin/sh
echo "Content-type: text/html"
echo
/home/bjorn/public_html/xxx.py >> yyy.txt 2>&1
#echo "<h1>hello world</h1>"
Hope this gets you on your way.
-- bjorn
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:
>
> #!/usr/local/bin/python
>
> 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?
>
> Gustaf
More information about the Python-list
mailing list