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

Improve reporting the "export image" error #89

Open
khaledk2 opened this issue Oct 11, 2021 · 1 comment
Open

Improve reporting the "export image" error #89

khaledk2 opened this issue Oct 11, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@khaledk2
Copy link

When I export an image using a specific id for the first time, it works fine:
omero zarr export Image:xx

But if I try to export it again using the same id, I get the error message at the end of this issue description.

Will mentioned that this is expected as Zarr won't overwrite the existing data that the user creates with the first export. The user can either delete before repeating or output to a different directory.

I think we need a more user-friendly message to inform the user explicitly about this rather than throwing an exception.

Traceback (most recent call last):
File "/home/khaled/anaconda3/envs/ome_ngff/bin/omero", line 8, in
sys.exit(main())
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/main.py", line 125, in main
rv = omero.cli.argv()
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1784, in argv
cli.invoke(args[1:])
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1222, in invoke
stop = self.onecmd(line, previous_args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1299, in onecmd
self.execute(line, previous_args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero/cli.py", line 1381, in execute
args.func(args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/cli.py", line 65, in _wrapper
return func(self, *args, **kwargs)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/cli.py", line 260, in export
image_to_zarr(image, args)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 27, in image_to_zarr
n_levels, axes = add_image(image, root, cache_dir=cache_dir)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 82, in add_image
return add_raw_image(
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/omero_zarr/raw_pixels.py", line 155, in add_raw_image
parent.create(
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/hierarchy.py", line 891, in create
return self._write_op(self._create_nosync, name, **kwargs)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/hierarchy.py", line 661, in _write_op
return f(*args, **kwargs)
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/hierarchy.py", line 897, in _create_nosync
return create(store=self._store, path=path, chunk_store=self._chunk_store,
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/creation.py", line 138, in create
init_array(store, shape=shape, chunks=chunks, dtype=dtype, compressor=compressor,
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/storage.py", line 353, in init_array
_init_array_metadata(store, shape=shape, chunks=chunks, dtype=dtype,
File "/home/khaled/anaconda3/envs/ome_ngff/lib/python3.9/site-packages/zarr/storage.py", line 384, in _init_array_metadata
raise ContainsArrayError(path)
zarr.errors.ContainsArrayError: path '0' contains an array

@sbesson
Copy link
Member

sbesson commented Oct 11, 2021

I suspect the OMERO path needs to check the existence of of the target Zarr folder and report an informative message to the user to what is implemented in the bioformats2raw export path

if target.exists():
self.ctx.die(111, f"{target.resolve()} already exists")
if image_target.exists():
self.ctx.die(111, f"{image_target.resolve()} already exists")

@sbesson sbesson added the enhancement New feature or request label Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants
@sbesson @khaledk2 and others