I'm running Ubuntu 18.04 droplets on DigitalOcean and need to set file transfers between them.
Pysftp/Paramiko libraries fits the job well, but I have trouble establishing connection. Connecting with same code from desktop works well.
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
with pysftp.Connection(host='ip adress', username='username',
password='pass', cnopts=cnopts) as sftp:
Error message when initializing connection is:
Traceback (most recent call last):
File "/home/airflow/airflow/tasks/ta_auto/screener_slave.py", line 315, in <module>
cnopts = pysftp.CnOpts()#knownhosts='/home/airflow/.ssh/known_hosts')
File "/home/airflow/pipeline/lib/python3.6/site-packages/pysftp/__init__.py", line 54, in __init__
self.hostkeys.load(knownhosts)
File "/home/airflow/pipeline/lib/python3.6/site-packages/paramiko/hostkeys.py", line 101, in load
e = HostKeyEntry.from_line(line, lineno)
File "/home/airflow/pipeline/lib/python3.6/site-packages/paramiko/hostkeys.py", line 364, in from_line
key = ECDSAKey(data=decodebytes(key), validate_point=False)
File "/home/airflow/pipeline/lib/python3.6/site-packages/paramiko/ecdsakey.py", line 163, in __init__
key = ec.EllipticCurvePublicKey.from_encoded_point(
AttributeError: type object 'EllipticCurvePublicKey' has no attribute 'from_encoded_point'