title: getting the file size with pycurl
body: <p>I want to write a downloader with python and I use PycURL as my library, but I got a problem.
  I can't get the size of the file wich I wanna download. Here is part of my code :</p>
  
  <pre><code>import pycurl
  url = 'http://www.google.com'
  c = pycurl.Curl()
  c.setopt(c.URL, url)
  print c.getinfo(c.CONTENT_LENGTH_DOWNLOAD)
  c.perform()
  </code></pre>
  
  <p>When I test this code in python shell, it's ok but when I write it as a function and run it, it gives me -1 instead of the size.
  What is the problem?</p>
  
  <p>(code's been edited)</p>