title: PyCurl TypeError: invalid argument to setopt
body: <p>I'm using PyCurl to send POST request with file as an attachment:</p>
  
  <pre><code>d = pycurl.Curl()
  d.setopt(pycurl.URL, url)
  # d.setopt(pycurl.RETURNTRANSFER, True)
  d.setopt(pycurl.POST, True)
  d.setopt(pycurl.POSTFIELDS, {filename: "@" + filename})
  b = StringIO.StringIO()
  d.setopt(pycurl.WRITEFUNCTION, b.write)
  d.perform()
  d.close()
  message = b.getvalue()
  </code></pre>
  
  <p>and I get:</p>
  
  <pre><code>Something went wrong, invalid arguments to setopt
  Traceback (most recent call last):
    File "hasoff.py", line 214, in create_offers_for_advertiser
      if filename:
  TypeError: invalid arguments to setopt
  </code></pre>
  
  <p>What's wrong?</p>