title: Postgres COPY FROM command not working through Python
body: <p>I have a Python script that uses the psycopg2 library to connect to Postgres and copy tables from the a Postgres database to text files (tab-separated). This works perfectly. I'm then trying to run a similar function, but this time taking the text files and inserting them into an identical table in a different Postgres database. My script is as follows:
  <br><br></p>
  
  <pre><code>def copyFromFile(tableName):
      try:
          cTo = None
          cTo = psycopg2.connect(database="postgres", user="postgres", password="postgres", host="localhost")
          tCursor = cTo.cursor()
          print 'here'
          io = open(tableName+'.txt', 'r')
          tCursor.copy_from(io, tableName)
          print 'done copying'
      except Exception as inst:
          print "I am unable to copy to " + tableName
  
  #start 
  copyFromFile('schema.tableName')
  </code></pre>
  
  <p>The text file looks like this:
  <br><br></p>
  
  <pre><code>95216   8802    269726  3   1350    1   2014-09-02 14:11:25.817178  I
  95217   8802    269726  4   1351    1   2014-09-02 14:11:25.817178  I
  95218   8802    269726  5   1352    1   2014-09-02 14:11:25.817178  I
  95219   8802    269726  6   1353    1   2014-09-02 14:11:25.817178  I
  95220   8802    269726  7   1354    1   2014-09-02 14:11:25.817178  I
  95221   8802    269726  8   1355    1   2014-09-02 14:11:25.817178  I
  95222   8802    269726  9   1356    1   2014-09-02 14:11:25.817178  I
  </code></pre>
  
  <p><br><br>
  When I run this script, I get no errors, but the database table gets no data. This table is empty to start with. What could be missing?</p>