python - python pysftp issue downloading directory from remote server
问题描述
sftp = pysftp.Connection(server, username=username, password=password)
if remotepath == "NOAA18":
sftp.get_r("/home/pi/AltiWx/data/NOAA-18/", localpath, preserve_mtime=True)
elif remotepath == "NOAA15":
sftp.get_r("/home/pi/AltiWx/data/NOAA-15/", localpath, preserve_mtime=True)
elif remotepath == "METEOR-M2":
sftp.get_r("/home/pi/AltiWx/data/METEOR-M2/", localpath, preserve_mtime=True)
elif remotepath == "NOAA19":
sftp.get_r("/home/pi/AltiWx/data/NOAA-19/", localpath, preserve_mtime=True)
elif remotepath == "ALL":
sftp.get_r("/home/pi/AltiWx/data/", localpath, preserve_mtime=True)
elif remotepath == "userinput":
userinput = remotepath
sftp.get_r(userinput, localpath, preserve_mtime=True)
so this is my code, i am using yaml to load a config and then everything goes into place, these are some presets i made. but then i get this error:
File "C:\Users\paolo\Desktop\pull\pull.py", line 33, in <module>
sftp.get_r("/home/pi/AltiWx/data/", localpath, preserve_mtime=True)
File "C:\Users\paolo\AppData\Local\Programs\Python\Python39\lib\site-packages\pysftp\__init__.py", line 309, in get_r
self.get(fname,
File "C:\Users\paolo\AppData\Local\Programs\Python\Python39\lib\site-packages\pysftp\__init__.py", line 249, in get
self._sftp.get(remotepath, localpath, callback=callback)
File "C:\Users\paolo\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\sftp_client.py", line 801, in get
with open(localpath, "wb") as fl:
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/paolo/Desktop\\./home/pi/AltiWx/data/ISS (ZARYA)/FM/20210720T214913Z/20210720T214913Z.wav'
i have no idea what to do tbh
解决方案
推荐阅读
- wpf - 来自 WPF 客户端的 AspNet.Core 身份验证
- java - 合并两个流以创建一个新流
- html - 如何在 CSS 中弹出顶部
- javascript - Angular 和 Leaflet 在点击时添加标记并获取坐标
- javascript - 即使这是预期的,Knexnest 查询也不返回数组中的数据
- angular - Angular8 创建动态容器,其他模块可以注入它们的组件
- r - 特定值后的 R geom_ribbon
- python - AWS Lambda - 与指数退避的 SQS 集成
- model-associations - 如何在没有外键cakephp3的情况下设置动态模型关联
- r - R - 当只有一行时,列类型从“数字”变为“未知”