pysftp

Pysftp "cd" fails against AIX server with "OverflowError: mode out of range" error

Pysftp "cd" fails against AIX server with "OverflowError: mode out of range" error Question: Having trouble getting the pysftp.connection.cd() working – not sure what I am doing wrong or what the issue is. I can achieve what I need by passing the full remote path into the relevant methods. But if try to change the …

Total answers: 1

pysftp putfo creates an empty file on SFTP server but not streaming the content from StringIO

pysftp putfo creates an empty file on SFTP server but not streaming the content from StringIO Question: My code first writes lines to a CSV in io.StringIO(): fileBuffer = io.StringIO() # write header header_writer = csv.DictWriter(fileBuffer, fieldnames=columnNames) header_writer.writeheader() # write lines writer = csv.writer(fileBuffer, delimiter=’,’) for line in data: line_dec = line.decode(‘ISO-8859-1’) # print([line_dec]) writer.writerow([line_dec]) …

Total answers: 1

How to fix import error "No module named '_cffi_backend' " when import pysftp from aws-lambda

How to fix import error "No module named '_cffi_backend' " when import pysftp from aws-lambda Question: I’m working on a simple script to connect my sftp server from aws-lambda and I’m getting Unable to import module ‘lambda_function’: No module named ‘_cffi_backend’ when I import pysftp from aws-lambda. I’m using python3.6 and only import pysftp nothing …

Total answers: 4

Python pysftp.put raises "No such file" exception although file is uploaded

Python pysftp.put raises "No such file" exception although file is uploaded Question: I am using pysftp to connect to a server and upload a file to it. cnopts = pysftp.CnOpts() cnopts.hostkeys = None self.sftp = pysftp.Connection(host=self.serverConnectionAuth[‘host’], port=self.serverConnectionAuth[‘port’], username=self.serverConnectionAuth[‘username’], password=self.serverConnectionAuth[‘password’], cnopts=cnopts) self.sftp.put(localpath=self.filepath+filename, remotepath=filename) Sometimes it does okay with no error, but sometime it puts the file …

Total answers: 2

Python – pysftp / paramiko – Verify host key using its fingerprint

Python – pysftp / paramiko – Verify host key using its fingerprint Question: This code throws an exception. How can I verify an SSH fingerprint without storing it in a file? I believe the code below is designed for a public key. But the client with the SFTP server validated the fingerprint and did not …

Total answers: 2

Is it possible to Remove Directory with some contents using pysftp module?

Is it possible to Remove Directory with some contents using pysftp module? Question: I am creating a backup script using pysftp module. I am able to upload and download files. When i am trying to Delete a directory with some contents i got an exception. This is what i tried con = pysftp.Connection(‘192.168.0.40′,username=’root’,password=’clado123′) con.chdir(‘/root/backup’) con.pwd …

Total answers: 4

Upload file via SFTP with Python

Upload file via SFTP with Python Question: I wrote a simple code to upload a file to a SFTP server in Python. I am using Python 2.7. import pysftp srv = pysftp.Connection(host="www.destination.com", username="root", password="password",log="./temp/pysftp.log") srv.cd(‘public’) #chdir to public srv.put(‘C:UsersXXXDropboxtest.txt’) #upload file to nodejs/ # Closes the connection srv.close() The file did not appear on the …

Total answers: 4