-
Notifications
You must be signed in to change notification settings - Fork 64
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
Cannot pickle path objects #223
Comments
Not sure about other providers, but for S3 I believe
Did a quick spike and adding this to def __getstate__(self):
state = self.__dict__.copy()
# don't pickle client
del state["client"]
return state
def __setstate__(self, state):
client = self._cloud_meta.client_class.get_default_client()
state["client"] = client
return self.__dict__.update(state) This needs tests and documentation. |
@ringohoffman this has been merged into the main branch. Would you mind installing the development version and testing your use case to confirm it works as expected? Thanks! |
@ringohoffman released in |
Verified it! @pjbull >>> import cloudpathlib
>>> import torch
>>>
>>>
>>> p = cloudpathlib.S3Path("s3://bucket/key")
>>> torch.save(obj=p, f="./s3.txt")
>>>
>>> torch.load(f="./s3.txt")
S3Path('s3://bucket/key') |
pickle
docs: What can be pickled and unpickled?The text was updated successfully, but these errors were encountered: