broken examples in reference? Help??
paul at fizzylab.com
paul at fizzylab.com
Fri Jun 16 02:17:03 EDT 2000
I am trying to work with python and it seems quite
straightforward most of the time, but I fear I may have a
broken binary or something else wrong.
I have typed verbatim an example from the python essential
reference and it doesn't seem to work: it just hangs. I know
I have networking (the other language that starts with a
'p' works fine for this kindof task).
#!/usr/bin/python
import httplib
h = httplib.HTTP('www.python.org')
h.putrequest('GET', '/index.html')
h.putheader('Accept', 'text/html')
h.putheader('Accept', 'text/plain')
h.endheaders
errcode,errmsg, headers = h.getreply()
print errcode
f= h.getfile()
data = f.read()
f.close
print data
Should this do what I expect (fetch a URL and print the
output)? Even if it shouldn't, it takes a long time to fail.
More information about the Python-list
mailing list