Skip to content

[FIX] Error in uploading new file with put #332

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

Merged
merged 4 commits into from
Mar 12, 2025

Conversation

machichima
Copy link
Contributor

When trying to put a new file to S3, I encounter following error:

RuntimeError: Loop is not running

This is caused by code here, as fsspec expect all functions run in its event loop.

except FileNotFoundError:
# use info in fsspec.AbstractFileSystem
loop = asyncio.get_running_loop()
return await loop.run_in_executor(None, super().info, path, **_kwargs)

Instead of running super().info when getting FileNotFoundError, I refer to the method used in s3fs (see here) that use _ls to check if it is directory. If not, raise FileNotFoundError.


# We check to see if the path is a directory by attempting to list its
# contexts. If anything is found, it is indeed a directory
out = await self._ls(path, detail=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment to this link https://github.com/fsspec/s3fs/blob/01b9c4b838b81375093ae1d78562edf6bdc616ea/s3fs/core.py#L1471-L1492

So that we know where we got it from

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem! I just added it

@kylebarron kylebarron merged commit f5988bb into developmentseed:main Mar 12, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants