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

Better group-member handling on non-existent paths #126

Merged
merged 1 commit into from
May 26, 2022

Conversation

johnkerl
Copy link
Member

Before:

[email protected][prod][python]$ peek-soma nonesuch
>>> soma.obsp.keys()
Traceback (most recent call last):
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/tiledb_group.py", line 84, in _open
    G = self._open_withlessly(mode)
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/tiledb_group.py", line 72, in _open_withlessly
    return tiledb.Group(self.uri, mode=mode, ctx=self._ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tiledb/group.py", line 188, in __init__
    super().__init__(cctx, uri, query_type)
tiledb.cc.TileDBError: [TileDB::Group] Error: Cannot open group; Group does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/annotation_pairwise_matrix_group.py", line 47, in keys
    return self._get_member_names()
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/tiledb_group.py", line 126, in _get_member_names
    return list(self._get_member_names_to_uris().keys())
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/tiledb_group.py", line 140, in _get_member_names_to_uris
    with self._open("r") as G:
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/tiledb_group.py", line 87, in _open
    G.close()
UnboundLocalError: local variable 'G' referenced before assignment

It's the UnboundLocalError: local variable 'G' referenced before assignment part which is super-confusing.

After:

[email protected][prod][python]$ peek-soma nonesuch
>>> soma.obsp.keys()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/annotation_pairwise_matrix_group.py", line 47, in keys
    return self._get_member_names()
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/tiledb_group.py", line 135, in _get_member_names
    return list(self._get_member_names_to_uris().keys())
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/tiledb_group.py", line 149, in _get_member_names_to_uris
    with self._open("r") as G:
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "/Users/johnkerl/git/single-cell-data/TileDB-SingleCell/apis/python/src/tiledbsc/tiledb_group.py", line 90, in _open
    raise Exception(f"Does not exist: {self.uri}")
Exception: Does not exist: nonesuch/obsp

@johnkerl johnkerl requested review from gspowley and aaronwolen May 26, 2022 16:46
@johnkerl johnkerl merged commit 8ff61f6 into main May 26, 2022
@johnkerl johnkerl deleted the kerl/group-member-nonesuch-handling branch May 26, 2022 16:56
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

Successfully merging this pull request may close these issues.

2 participants