Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #12040 (new)

Opened 10 years ago

Last modified 10 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 10 years ago by wmoore

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 = False

Then

        if not reportlabInstalled:
            client.setOutput(
                "Message",
                rstring("Install https://bitbucket.org/rptlab/reportlab"))
        else:
            // run the script

comment:2 Changed 10 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 10 years ago by spli

#8555 covers import errors, I was envisaging a more general error handler.

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.62625 sec.)

We're Hiring!