1

I can't find anything about this exception. I am trying to rename a remote file on a local (Windows) SFTP server with fsspec. Paramiko behind the scenes is doing a posix_rename(). What does the error mean?

fs.rename(old_file_path, new_file_path)

Paths look like /folder/file.ext.

I can rename files with other FTP clients on that same server.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
cdonner
  • 37,019
  • 22
  • 105
  • 153

2 Answers2

1

Indeed, fsspec SFTPFileSystem.mv calls Paramiko SFTPClient.posix_rename. That's imo a bad choice. The SFTPClient.posix_rename internally uses a proprietary OpenSSH posix-rename@openssh.com extension, which is naturally not supported by most other SFTP servers (such as yours).

I do not know what is the best solution/workaround. You can probably add your own "file system" implementation based on SFTPFileSystem, reimplementing SFTPFileSystem.mv to call standard Paramiko SFTPClient.rename (which uses standard SFTP rename request).

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
1

Actually, I just found that the SFTPClient is exposed through the SFTPFileSystem and I can call rename() on it directly, which worked!

fs.ftp.rename("testfile.txt", "x")
cdonner
  • 37,019
  • 22
  • 105
  • 153