Anyone else noticed that the pycurl example doesn't work on Python 2.*?
import pycurl
from StringIO import StringIO
buffer = StringIO()
c = pycurl.Curl()
c.setopt(c.URL, 'http://pycurl.sourceforge.net/')
c.setopt(c.WRITEDATA, buffer)
c.perform()
c.close()
body = buffer.getvalue()
# Body is a string in some encoding.
# In Python 2, we can print it without knowing what the encoding is.
print(body)
Then I get a failure like this
Traceback (most recent call last):
File "./get_python2.py", line 9, in <module>
c.setopt(c.WRITEDATA, buffer)
TypeError: invalid arguments to setopt
Assigning WRITEFUNCTION & others seem to function as advertised. Anyone know what's going on here?