title: Increment variable in callback during upload
body: <p>I have the following python script for an upload that needs to show percent done.  I am having trouble incrementing the variable that tracks the amount of data transferred.
  I get an<br>
  <em>UnboundLocalError: local variable 'intProgress' referenced before assignment</em><br>
  error.  Yet if I try to print this variable it prints fine so it seems that it is referenced.</p>
  
  <pre><code>import os, sys, ftplib
  pathname = 'C:/Paradigm1/1.PNG'
  intFileSize = os.path.getsize(pathname)
  intPercentDone = 0
  intProgress = 0
  
  def callback(p):
      intProgress = intProgress + 1024
      ##sys.stdout.write(str(intProgress))
      sys.stdout.write("-")
  session = ftplib.FTP('Server','UserName','Password')
  f = open(pathname,'rb')# file to send
  session.storbinary('STOR /Ftp Accounts/PublicDownloads/test.png', f, 1024, callback)
  f.close()
  </code></pre>