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

Linux filepaths do not work on Windows #345

Open
codie3611 opened this issue Jun 19, 2020 · 1 comment
Open

Linux filepaths do not work on Windows #345

codie3611 opened this issue Jun 19, 2020 · 1 comment
Labels

Comments

@codie3611
Copy link

codie3611 commented Jun 19, 2020

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]

@ihnorton ihnorton self-assigned this Jun 19, 2020
@ihnorton ihnorton removed their assignment Mar 29, 2021
@JohnMoutafis
Copy link

Late to the party, but there are 2 OS-agnostic ways to declare path joins like this:

  1. 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")
    
  2. 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"
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants