Task #12979 (accepted)
Opened 9 years ago
Last modified 9 years ago
RFE: improve error message for CLI export onto existing file
Reported by: | mtbcarroll | Owned by: | cblackburn |
---|---|---|---|
Priority: | minor | Milestone: | Unscheduled |
Component: | OmeroPy | Version: | OMERO-5.1.3 |
Keywords: | n.a. | Cc: | python-team@… |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | n.a. |
Sprint: | n.a. |
Description
bin/omero export --file /tmp/foo.ome.tif Image:1
produces some nasty error about invalid NewFileType('wb') if /tmp/foo.ome.tif already exists. Perhaps we could improve the message.
Change History (6)
comment:1 Changed 9 years ago by cblackburn
comment:2 Changed 9 years ago by jamoore
I'd say we shouldn't be patching argparse.
comment:3 Changed 9 years ago by cblackburn
I'd agree, especially as it is slated from removal from omero_ext. We may be able to tidy up the output bu I am not sure how easy it would be to provide the actual message. For the longer term, maybe raise and issue against argpase?
comment:4 Changed 9 years ago by cblackburn
Ah, I think I have it:
ls30778:openmicroscopy colin$ omero export --file foo.ome.tif Image:1 usage: /Users/colin/Work/repos/openmicroscopy/dist/bin/omero export [-h] -f FILE [-t {TIFF,XML}] [--iterate] [-C] [-s SERVER] [-p PORT] [-g GROUP] [-u USER] [-w PASSWORD] [-k KEY] [--sudo ADMINUSER] [-q] obj /Users/colin/Work/repos/openmicroscopy/dist/bin/omero export: error: argument -f/--file: File exists: foo.ome.tif
comment:5 Changed 9 years ago by cblackburn
- Status changed from new to accepted
It looks like this is arising in omero_ext/argparse.py where any message in the ValueError is ignored in favour of a generic message created at this point. We could patch our local copy of argparse.py to handle this but do we want to do that now that this package is bundled with the Python standard library?