Open kujenga opened 3 weeks ago
Thanks @kujenga.
Since _client
is created on demand I think the fix here is just to update __getstate__
with:
if "_client" in state:
del state["_client"]
Would be happy to take a PR that does that and adds a test.
Thanks!
Sounds good! PR submitted here: https://github.com/drivendataorg/cloudpathlib/pull/454
The following code causes a crash, which can arise when passing cloudpathlib objects to/from subprocesses.
The exception raised is:
The issue seems to be that these methods are not symmetrical, and the _client field is not restored when the object is unpickled in a way that might mirror this example in the docs https://docs.python.org/3/library/pickle.html#pickle-state at this point in the code: https://github.com/drivendataorg/cloudpathlib/blob/08b018b36f90f89003e0c9e5ebd19030b41c2433/cloudpathlib/cloudpath.py#L262-L272