无法用python脚本sftp获取文件

2024-04-20 13:36:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要获取文件并在python中将内容分配给行数组。你知道吗

我正在使用psftp,但我不断收到文件错误,我知道文件在那里:

以下是我所拥有的:

import pysftp
myfile="daily_data_file_122300.csv"
sftp = pysftp.Connection('192.168.101.123', username='userid', password='userpassd')
sftp.cwd('userid')
sftp.get('myfile', preserve_mtime=True)

sftp.close() 

我得到这个错误:

IOError: [Errno 2] No such file

文件在那里。你知道吗


Tags: 文件csvimport内容data错误数组myfile