Skip to content

[ERROR] Error when specifying a Path object as destination for a COG #239

@guillemc23

Description

@guillemc23

Currently running odc-geo == 0.5.0rc1.

I'm passing a Path object as destination to store a COG and it's raising an error in this line:

parsed_url = urlparse(dst)

I believe it would be useful and definitely pythonic to support this input type, but I'm not sure how to proceed to PR it myself.

It is reproducible just by:

from pathlib import Path
from odc.geo.cog import save_cog_with_dask

dst = Path("test.tiff")
...
d = save_cog_with_dask(xx, dst)
AttributeError: 'PosixPath' object has no attribute 'decode'

Maybe checking the type of the argument before calling urlparse could be a solution, but I'm wondering what implications can it have if we allow as well S3Path, UPath and other kinds of Path objects that extend python Path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions