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

calling flush on s3fs fails #859

Open
Skylion007 opened this issue Mar 12, 2024 · 2 comments
Open

calling flush on s3fs fails #859

Skylion007 opened this issue Mar 12, 2024 · 2 comments

Comments

@Skylion007
Copy link

Calling f.flush() on an S3FS openfile, fails with the following trace:

Exception ignored in: <function AbstractBufferedFile.__del__ at 0x7f0790fc8dc0>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/fsspec/spec.py", line 1954, in __del__
    self.close()
  File "/usr/lib/python3/dist-packages/fsspec/spec.py", line 1931, in close
    if not self.forced:
AttributeError: 'S3File' object has no attribute 'forced'

Not sure if this error should be opened up with fsspec instead.

@Skylion007
Copy link
Author

Upon further research, this was caused due to leaving an openfile context when trying to open a file with an unsupported filemode, still though, we should probably try to be a bit better about handling this error.

@Skylion007 Skylion007 reopened this Mar 14, 2024
@martindurant
Copy link
Member

Ah, so this happens during interpreter shutdown: so the attributes of the S3File got cleaned up before the file object itself. I'm not sure what can be done about it, since it's very unlikely that making the actual call to the server can succeed, so maybe __del__ should just warn or silently ignore this kind of thing?

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