Skip to content
Snippets Groups Projects
Commit 00615c97 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

write_accessor returns filename, not path

parent 5d04888b
No related branches found
No related tags found
No related merge requests found
......@@ -148,11 +148,16 @@ class _Session(object):
def write_accessor(self, acc_id: str, filename: Union[str, None] = None) -> str:
"""
Write an accessor to file and unload it from the session
:param acc_id: accessor's ID
:param filename: force use of a specific filename, raise InvalidPathError if this already exists
:return: name of file
"""
if filename is None:
fp = self.paths['outbound_images'] / f'{acc_id}.tif'
else:
fp = self.paths['outbound_images'] / filename
if fp.exists():
raise InvalidPathError(f'Cannot overwrite file {filename} when writing accessor')
acc = self.get_accessor(acc_id, pop=True)
old_fp = self.accessors[acc_id]['filepath']
......@@ -163,7 +168,7 @@ class _Session(object):
acc.write(fp)
self.accessors[acc_id]['filepath'] = fp.__str__()
return fp.__str__()
return fp.name
@staticmethod
def make_paths(root: str = None) -> dict:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment