Skip to content

To be able to use relative (to HOME) path #55

Open
@yarikoptic

Description

not yet sure if relates to

but ATM it seems it is impossible to use relative path :-/ Trying with a simple open

and this helper script
#!/usr/bin/env python3

import fsspec
print(f'fsspec {fsspec.__version__}')
from fsspec import open
import sys

url, lines = sys.argv[1:3]
lines = int(lines)
with open(url, 'r') as f:
    for i in range(lines):
        print(f.readline().rstrip())

works for full path:

❯ python ~/.tmp/fsspec_ssh ssh://smaug.datalad.org/home/yoh/.emacs 1
fsspec 2024.12.0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

but that requires then first knowing/discovering the home folder for the user (usually ssh uri is just like hostname:path/relative/to/home) and would require some direct ssh invocation first. Any attempt to make it relative, didn't work:

❯ python ~/.tmp/fsspec_ssh ssh://smaug.datalad.org/~/.emacs 1
...
FileNotFoundError: [Errno 2] No such file or directory

❯ python ~/.tmp/fsspec_ssh ssh://smaug.datalad.org/./.emacs 1
...
FileNotFoundError: [Errno 2] No such file or directory

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