You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEAT] - Implement io.IOBase protocol for opened SFTP file objects #2452
Is this feature for paramiko acting as a client or a server?
Client
What functionality does this feature request relate to?
SFTP
For client-side features, does this relate to a specific type of SSH server?
No response
If you're using paramiko as part of another tool, which tool/version?
No response
Desired behavior
I am opening a file object via SFTPClient.open. The returned file object looks very much like a typical Python file object, but differs in two ways noticable for my use case:
It inherits from paramiko.sftp_file.SFTPFile and does not have io.IOBase in its inheritance hierarchy, i.e., isinstance(fileobj, io.IOBase) does not work.
paramiko.sftp_file.SFTPFile.write does not return the number of bytes that have been written, which is also in conflict with IOBase.
I guess, I will need to either inject-replace a new seek method or more cleaner, but maybe worse for performance and code conciseness, wrap paramiko.sftp_file.SFTPFile in a new class that correctly implements the io.IOBase protocol.
Activity
Return new file position from SFTPFile.seek