TileDB-Py
TileDB-Py copied to clipboard
Linux filepaths do not work on Windows
I've got the following relative filepath "./test/jobs/store/python-save-vars/x"
where x
is simply a file. When accesing on windows with:
impor tiledb
vfs = tiledb.VFS()
uri = "./test/jobs/store/python-save-vars/x"
vfs.file_size(uri)
I get the following error:
Traceback (most recent call last):
File "tiledb/libtiledb.pyx", line 5227, in tiledb.libtiledb.VFS.file_size
File "tiledb/libtiledb.pyx", line 453, in tiledb.libtiledb._raise_ctx_err
File "tiledb/libtiledb.pyx", line 438, in tiledb.libtiledb._raise_tiledb_error
tiledb.libtiledb.TileDBError: [TileDB::IO] Error: Failed to get file size for \'\\test\\jobs\\store\\python-save-vars\\x\'
Though if I convert slashes do backslashes it works:
uri2 = uri.replace("/","\\")
vfs.file_size(uri2)
I would expect tiledb to also handle slashes on windows.
I'm using tiledb=0.6.1 (libtiledb=2.0.2) on Windows with Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32.
[#294]
Late to the party, but there are 2 OS-agnostic ways to declare path joins like this:
-
The os.path.join will add the appropriate OS file separator in between the parts to be joined. Use it as follows:
uri = os.path.join("test", "jobs", "store", "python-save-vars", "x")
-
If you don't want to use the
join
method (why not though) you can concat the path manually and add the os.sep in between:uri = "test" + os.sep + "jobs" + os.sep + "store" + os.sep + "python-save-vars" + os.sep + "x"