【发布时间】:2019-12-21 02:16:50
【问题描述】:
昨晚我正在编写我的第一个 pySFTP Notebook,我能够让它工作。我上床睡觉的时候它还在工作,但现在不行了。我收到连接命令错误....
import pysftp
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None # disable host key checking.
#with pysftp.Connection('test.rebex.net', username='demo',password='password', cnopts=cnopts) as sftp:
# do stuff here
# print('this works!')
s = pysftp.Connection(host='test.rebex.net', username='demo', password='password', cnopts=cnopts)
data = s.listdir()
s.close()
for i in data:
print (i)
我收到的错误是...
Unknown exception: from_buffer() cannot return the address of the raw string within a bytes or unicode object
Traceback (most recent call last):
File "/databricks/python/lib/python3.5/site-packages/paramiko/transport.py", line 2075, in run
self.kex_engine.parse_next(ptype, m)
File "/databricks/python/lib/python3.5/site-packages/paramiko/kex_curve25519.py", line 64, in parse_next
return self._parse_kexecdh_reply(m)
File "/databricks/python/lib/python3.5/site-packages/paramiko/kex_curve25519.py", line 129, in _parse_kexecdh_reply
self.transport._activate_outbound()
File "/databricks/python/lib/python3.5/site-packages/paramiko/transport.py", line 2553, in _activate_outbound
self.local_cipher, key_out, IV_out, self._ENCRYPT
File "/databricks/python/lib/python3.5/site-packages/paramiko/transport.py", line 1934, in _get_cipher
return cipher.encryptor()
File "/databricks/python/lib/python3.5/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 121, in encryptor
self.algorithm, self.mode
File "/databricks/python/lib/python3.5/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 298, in create_symmetric_encryption_ctx
return _CipherContext(self, cipher, mode, _CipherContext._ENCRYPT)
File "/databricks/python/lib/python3.5/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 67, in __init__
iv_nonce = self._backend._ffi.from_buffer(mode.nonce)
TypeError: from_buffer() cannot return the address of the raw string within a bytes or unicode object
TypeError: from_buffer() cannot return the address of the raw string within a bytes or unicode object
感谢您的帮助!
【问题讨论】:
-
此错误似乎间歇性/不一致地发生。我将脚本安排为作业,有时它可以工作,而有时它不能 - 无论文件是否可用。
-
另外,我需要更具体地了解将哪个 pysftp libraru 加载到我的集群中。我指定了 pysftp==0.2.9。这似乎没有解决问题。
标签: python-3.x azure-databricks pysftp