diff --git a/fsspec/implementations/arrow.py b/fsspec/implementations/arrow.py index 530df901a..19eaa9b96 100644 --- a/fsspec/implementations/arrow.py +++ b/fsspec/implementations/arrow.py @@ -75,10 +75,13 @@ def ls(self, path, detail=False, **kwargs): path = self._strip_protocol(path) from pyarrow.fs import FileSelector - entries = [ - self._make_entry(entry) - for entry in self.fs.get_file_info(FileSelector(path)) - ] + try: + entries = [ + self._make_entry(entry) + for entry in self.fs.get_file_info(FileSelector(path)) + ] + except (FileNotFoundError, NotADirectoryError): + entries = [self.info(path, **kwargs)] if detail: return entries else: diff --git a/fsspec/implementations/tests/test_arrow.py b/fsspec/implementations/tests/test_arrow.py index b9cbb2137..d564cc4ce 100644 --- a/fsspec/implementations/tests/test_arrow.py +++ b/fsspec/implementations/tests/test_arrow.py @@ -151,6 +151,17 @@ def test_ls(fs, remote_dir): assert dirs == expected +def test_ls_one(fs, remote_dir): + if remote_dir != "/": + remote_dir = remote_dir + "/" + fs.mkdir(remote_dir + "dir/") + file = remote_dir + "dir/test_one" + fs.touch(file) + + out = fs.ls(file, detail=True) + assert out[0] == fs.info(file) + + def test_mkdir(fs, remote_dir): if remote_dir != "/": remote_dir = remote_dir + "/"