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

get_file behaves differently using SSHFileSystem vs LocalFileSystem #20

Open
sguldemond opened this issue Mar 21, 2022 · 1 comment
Open

Comments

@sguldemond
Copy link

I've implemented the AbstractFileSystem in my code in order to direct my application either to the local file system or file system over SSH. Only I noticed that the behavior of get_file is different in both. I wrote this little script to test and demonstrate.

from fsspec.implementations.local import LocalFileSystem
from sshfs import SSHFileSystem

ssh_fs = SSHFileSystem(
    "localhost",
    username="foobar",
    password="foobar",
)
ssh_fs.get_file("/tmp/foobar", ".")

local_fs = LocalFileSystem()
local_fs.get_file("/tmp/foobar2", ".")

I would expect that calling get_file on either with similar parameters would result the copying of the requested file to the local folder. Only the LocalFileSystem implementation results in an error:

IsADirectoryError: [Errno 21] Is a directory: '/home/west/Research/sshfs/.'

The LocalFileSystem implementation requires a full file path:

local_fs.get_file("/tmp/foobar2", "./foobar2")

I seems to me that the implemenation of get_file in SSHFileSystem does not follow the fsspec API. Or am I missing something?

@sguldemond sguldemond changed the title get_file behaves differently using SSHFileSystem vs LocalFileSystem get_file behaves differently using SSHFileSystem vs LocalFileSystem Mar 21, 2022
@efiop
Copy link
Member

efiop commented Apr 6, 2022

Hi @sguldemond !

Good catch! Indeed, it is an inconsistecy with LocalFileSystem. I'm not 100% sure how all other implementations behave though. My guess is that it probably depends on the underlying library that is used in particular implementation. One could possibly consider this an extended feature support, so I'm not sure if this is really worth going around and unifying across all implementations. This needs a bit more research to see if there is a more general solution that is feasible.

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

2 participants