pysftp put error “size mismatch in put! 0 != 14911”

i looked around for this error, but all I could really find is similar mismatch errors for python 3.3 support. I originally was getting errors when trying to use a *.txt wildcard to put all files in the localpath to the remotepath, kept getting file does not exist errors… so i finally just tried this with a single file, and got this:

size mismatch in put! 0 != 14911

Here is the code, along with python info, running linux mint 13 maya. Im really new to python and this module, and new to programming period. So dont assume i know what you are talking about….=P

Python 2.7.3 (default, Apr 20 2012, 22:39:59) [GCC 4.6.3] on linux2

import pysftp as sftp

def putjob():
        s = sftp.Connection(host='', username='username', password='password')



    except Exception, e:
        print str(e)



ymonad had it correct, pysftp was returning the size of the directory entry as requested.

You are correct, that pysftp does not do recursive directory copying currently. However, there is an issue for it in the tracker, so you can vote for it.

or roll your own and send a pull request!

Source: stackoverflow
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .