drivendataorg / drivendataorg/cloudpathlib
`AnyPath.rmtree()` does not work with local paths
- Dominant language
- Python
- Stars
- 628
- Forks
- 88
- Avg merge
- 17h 28m
- Merged PRs (30d)
- 2
Description
I'm using `cloudpathlib.AnyPath` to be able to fall back to a local filesystem for e.g. testing. However, it seems that `AnyPath.rmtree()` does not work correctly if the path points to the local filesystem. E.g.
```python
import cloudpathlib
p = cloudpathlib.AnyPath("testdir")
p.mkdir()
p.rmtree()
```
results in
```
Traceback (most recent call last):
File "/workspaces/scoutingtool/backend/test.py", line 4, in
p.rmtree()
^^^^^^^^
AttributeError: 'PosixPath' object has no attribute 'rmtree'
```
It would be nice if `AnyPath` supported `rmtree()`. The workaround is to check if the path points to the local filesystem, and then using `shutil.rmtree()` instead in that case, but that complicates the code a bit.
Contributor guide
Assessment
This issue has not been assessed yet.