Skip to content

UPath is not a PathLike #438

Description

@Mr-Pepe

I upgraded to UPath 0.3.2 and now I am getting type checking errors with basedpyright because __fspath__ is missing.

import os

from upath import UPath

path = UPath(__file__)

os.remove(path)

Basedpyright outputs:

error: Argument of type "UPath" cannot be assigned to parameter "path" of type "StrOrBytesPath" in function "remove"
    Type "UPath" is not assignable to type "StrOrBytesPath"
      "UPath" is not assignable to "str"
      "UPath" is not assignable to "bytes"
      "UPath" is incompatible with protocol "PathLike[str]"
        "__fspath__" is not present
      "UPath" is incompatible with protocol "PathLike[bytes]"
        "__fspath__" is not present (reportArgumentType)
1 error, 0 warnings, 0 notes

Are there any migration instructions I have missed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentation 📘Improvements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions