-
-
Notifications
You must be signed in to change notification settings - Fork 176
ftpfs possible issue with openbin #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yeah, perhaps FTPFS should also be doing this? https://github.com/PyFilesystem/pyfilesystem2/blob/master/fs/osfs.py#L360 |
Yes, I was thinking of mentioning use of I guess another way of putting the question is that, given the " |
The base class only guarantees that So it would be a mistake to assume that all file-like objects have a "mode" attribute. But people do write broken code because they make reasonable assumptions and the specifications are too difficult to understand, so perhaps it would be a good idea for ftp files to add a mode attribute. |
The I think a solution to this, similar to the previous note about osfs, would be to have the final two lines of
|
Actually, it is reasonable to expect |
Recently, while trying out the ftpfs, I've noticed that to open a binary file-like object for writing by some third-party packages I have to do this:
Note in the above the mode param used in
openbin
includesb
: Looking at the docs for the mode param it suggests theb
is implied viaopenbin
, butb
isn't implicitly added to the mode of the file-like that is returned byopenbin
- this means that, unlessb
is explicitly provided as above, third-party packages that inspect the mode of the file-like may complain that it is not opened in binary mode.Should
openbin
not reflect the impliedb
by implicitly addingb
to the mode?The text was updated successfully, but these errors were encountered: