Skip to content
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

'S3File' object has no attribute 'forced' #925

Closed
digital-idiot opened this issue Dec 30, 2024 · 4 comments
Closed

'S3File' object has no attribute 'forced' #925

digital-idiot opened this issue Dec 30, 2024 · 4 comments

Comments

@digital-idiot
Copy link

digital-idiot commented Dec 30, 2024

Getting the following error when trying to create and write to a file:

Related Original Issue: Toblerity/Fiona#1476 (comment)

Exception ignored in: <function AbstractBufferedFile.__del__ at 0x10788b560>
Traceback (most recent call last):
  File "~/.micromamba/envs/PyDev/lib/python3.12/site-packages/fsspec/spec.py", line 2216, in __del__
    self.close()
  File "~/.micromamba/envs/PyDev/lib/python3.12/site-packages/fsspec/spec.py", line 2177, in close
    if not self.forced:
           ^^^^^^^^^^^
AttributeError: 'S3File' object has no attribute 'forced'

fsspec.__version__
Out: '2024.12.0'

s3fs.__version__
Out: '2024.12.0'

EDIT

Turns out fiona is using 'wb+' file mode which does not seem to be supported by 'S3File' object.

@martindurant
Copy link
Member

Turns out fiona is using 'wb+' file mode which does not seem to be supported by 'S3File' object.

Would you be willing to provide a PR to raise an appropriate exception for this case? Seeking and writing inplace for remote files is not generally possible, uploads are always essentially streamed.

@digital-idiot
Copy link
Author

Would you be willing to provide a PR

Yes. I will try to submit a PR in the coming weekend. Hopefully, I will be able to triag how fiona instantiating the fsspec.AbstractBufferedFile object with wb+ mode in the first place. Because according to the following, direct instantiation ought to throw exception.

https://github.com/fsspec/filesystem_spec/blob/1d34249f0b043907f86064c274a33454ec670ebe/fsspec/spec.py#L1878-L1879

@martindurant
Copy link
Member

direct instantiation ought to throw exception

indeed

@digital-idiot
Copy link
Author

Closing this for now, doesn't seem like a fsspec/s3fs issue exactly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants