Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pysftp put error "size mismatch in put! 0 != 14911"

Tags:

python

pysftp

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():
    try:
        s = sftp.Connection(host='secure.sftp.site', username='username', password='password')

        remotepath='/Home/xxx24659/Upload/'
        localpath='/home/xxx24659/Local/Upload/Q0001.txt'
        s.put(localpath,remotepath)

        s.close()

    except Exception, e:
        print str(e)

putjob()
like image 272
Dogbyte Avatar asked Jan 25 '26 17:01

Dogbyte


1 Answers

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.

https://bitbucket.org/dundeemt/pysftp/issue/10/remote-walkdirs

or roll your own and send a pull request!

like image 99
Dundee MT Avatar answered Jan 27 '26 05:01

Dundee MT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!