You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FS uses three special characters (:, @, and !) to infer things about the path. This is perfectly fine when working with remote filesystems; however, locally this can cause issues because @ and ! are allowed on all major OSes (linux also allows :, but neither windows nor mac do).
As a result, FS gets confused when passing a local path that contains such characters (see PyFilesystem/pyfilesystem2#562 for details). Ideally, FS would deal with this automatically; however, an alternative (and perhaps more compatible) way of handling this would be for us to pass percent-encoded strings to FS. Instead of writing the following:
we would call urllib.parse.quote just before (ofc with the import moved to an appropriate location):
defcopy_file_to_fs_folder(
src_path: str,
dst_fs: FS,
dst_folder_path: str=".",
dst_filename: t.Optional[str] =None,
):
"""Copy the given file at src_path to dst_fs filesystem, under its dst_folder_path folder with dst_filename as file name. When dst_filename is None, keep the original file name. """fromurllib.parseimportquotesrc_path=os.path.realpath(os.path.expanduser(src_path))
dir_name, file_name=os.path.split(src_path)
src_fs=fs.open_fs(quote(dir_name))
dst_filename=file_nameifdst_filenameisNoneelsedst_filenamedst_path=fs.path.join(dst_folder_path, dst_filename)
dst_fs.makedir(dst_folder_path, recreate=True)
fs.copy.copy_file(src_fs, file_name, dst_fs, dst_path)
It is more like a bug of pyfilesystem2, but it doesn't have updates for 9 months. We might replace it in the future, but now we can workaround it in BentoML.
Describe the bug
FS uses three special characters (
:
,@
, and!
) to infer things about the path. This is perfectly fine when working with remote filesystems; however, locally this can cause issues because@
and!
are allowed on all major OSes (linux also allows:
, but neither windows nor mac do).As a result, FS gets confused when passing a local path that contains such characters (see PyFilesystem/pyfilesystem2#562 for details). Ideally, FS would deal with this automatically; however, an alternative (and perhaps more compatible) way of handling this would be for us to pass percent-encoded strings to FS. Instead of writing the following:
BentoML/src/bentoml/_internal/utils/__init__.py
Lines 267 to 283 in fb08105
we would call
urllib.parse.quote
just before (ofc with the import moved to an appropriate location):To reproduce
No response
Expected behavior
No response
Environment
Environment variable
System information
bentoml
: 1.0.13python
: 3.8.8platform
: Windows-10-10.0.22000-SP0is_window_admin
: Falsepip_packages
The text was updated successfully, but these errors were encountered: