Task #12040 (new)
Opened 5 years ago
Last modified 5 years ago
Improve error message when a script can't be run
| Reported by: | spli | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | Unscheduled |
| Component: | Scripting | Version: | 5.0.0 |
| Keywords: | n.a. | Cc: | analysis@… |
| Resources: | n.a. | Referenced By: | n.a. |
| References: | n.a. | Remaining Time: | n.a. |
| Sprint: | n.a. |
Description
If the Processor service is functional but a script cannot be run, for instance due to an import error (e.g. numpy not installed) a 'No Processor' error is returned. This is misleading, instead we should distinguish between failure of the service (#8266) and failure of the script.
Change History (3)
comment:1 Changed 5 years ago by wmoore
comment:2 Changed 5 years ago by jamoore
A block like Will's makes sense where there's a special requirement (though, likely we should have a helper method to do this), but is the larger issue covered by #8555?
comment:3 Changed 5 years ago by spli
#8555 covers import errors, I was envisaging a more general error handler.
What I have done in these cases is to wrap the import in try/except, then test for this when the script is run and return a suitable message to the user. For example, in my OMERO.figure PDF generating script
try: from reportlab.pdfgen import canvas from reportlab.lib.styles import getSampleStyleSheet from reportlab.lib.units import inch from reportlab.platypus import Paragraph, Frame # from reportlab.lib.pagesizes import letter, A4 reportlabInstalled = True except ImportError: reportlabInstalled = FalseThen
if not reportlabInstalled: client.setOutput( "Message", rstring("Install https://bitbucket.org/rptlab/reportlab")) else: // run the script