Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yarikoptic opened this issue Dec 30, 2024 · 0 comments
Open

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

yarikoptic opened this issue Dec 30, 2024 · 0 comments

Comments

@yarikoptic
Copy link
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant