Traceback (most recent call last):
  File "", line 1, in <module>
    import pysftp as sftp
  File "/usr/local/lib/python3.4/dist-packages/pysftp/", line 12, in <module>
    import paramiko
  File "/usr/local/lib/python3.4/dist-packages/paramiko/", line 30, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/usr/local/lib/python3.4/dist-packages/paramiko/", line 32, in <module>
    from cryptography.hazmat.backends import default_backend
ImportError: No module named 'cryptography'

Why am I getting the above error when I run the following script. Please note that I've tried using just python (which is 2.x) and python3 and I've installed paramiko, pycrypto, and pysftp for by 2.x and 3

import pysftp as sftp

def push_file_to_server():
    s = sftp.Connection(host='address', username='user', password='xxx')
    local_path = 'testme.txt'
    remote_path = '/home/testme.txt'

    s.put(local_path, remote_path)



Perhaps you need the cryptography module Click Here ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.