TypeError: isfile() missing 1 required positional argument : 'remotepath'
TypeError: isfile() missing 1 required positional argument : 'remotepath'
with pysftp.Connection(ipaddr, username="uname", password="pass", cnopts=cnopts) as sftp:
sftp.put(uploc + ufile, "/home/pi/PIFTP/dloads/" + ufile)
checkfile = ("/home/pi/PIFTP/dloads/" + ufile)
chfile = pysftp.Connection.isfile(checkfile)
if chfile == True:
print (Style.BRIGHT + "[" + Fore.GREEN + "OK" + Fore.WHITE + "] ")
else:
print (Style.BRIGHT + Fore.RED + ipaddr + " is unacsessible")
如您所见,我正在尝试检查刚刚上传的文件。在这种情况下 "/home/pi/PIFTP/dloads/" + ufile
是文件的远程下载路径。我错过了什么?谢谢
文件也在错误之前到达。
您需要使用您拥有的 Connection
实例 sftp
,而不是 class。
chfile = sftp.isfile(checkfile)
with pysftp.Connection(ipaddr, username="uname", password="pass", cnopts=cnopts) as sftp:
sftp.put(uploc + ufile, "/home/pi/PIFTP/dloads/" + ufile)
checkfile = ("/home/pi/PIFTP/dloads/" + ufile)
chfile = pysftp.Connection.isfile(checkfile)
if chfile == True:
print (Style.BRIGHT + "[" + Fore.GREEN + "OK" + Fore.WHITE + "] ")
else:
print (Style.BRIGHT + Fore.RED + ipaddr + " is unacsessible")
如您所见,我正在尝试检查刚刚上传的文件。在这种情况下 "/home/pi/PIFTP/dloads/" + ufile
是文件的远程下载路径。我错过了什么?谢谢
文件也在错误之前到达。
您需要使用您拥有的 Connection
实例 sftp
,而不是 class。
chfile = sftp.isfile(checkfile)