Skip to content

Path loses leading // after joinpath operation #18

@kcpevey

Description

@kcpevey

I can do this:

from upath import UPath
import pandas as pd

pd.read_csv(str(UPath('gs://bucket/filename.csv')))

but not this:

up = UPath('gs://') 
pd.read_csv(str(up.joinpath('bucket', 'colombia/filename.csv')))

This is because

str(UPath('gs://bucket/filenamecsv'))

gives 'gs://bucket/colombia/filename.csv' which maintains the leading //
while

str(UPath('gs://').joinpath('bucket', 'filename.csv'))

gives 'gs:/bucket/filename.csv' which is invalid.

This is important because I need to be able to programmatically construct the path separate from the bucket. The idea behind this tool is to keep me from using f strings, but it appears that is my only option here.

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