sshfs icon indicating copy to clipboard operation
sshfs copied to clipboard

To be able to use relative (to HOME) path

Open yarikoptic opened this issue 1 month ago • 0 comments

not yet sure if relates to

  • https://github.com/fsspec/sshfs/issues/46

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

yarikoptic avatar Dec 30 '24 00:12 yarikoptic