ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 30 forks source link

Draw rectangle fix #409

Closed emilroz closed 3 years ago

emilroz commented 3 years ago

Not sure about the cause or how to reproduce as it's been reported to us via support channel. In some conditions it's possible to run into the following issue:

Traceback (most recent call last):

  File "./script", line 2361, in <module>

    run_script()

  File "./script", line 2347, in run_script

    file_annotation = export_figure(conn, script_params)

  File "./script", line 2303, in export_figure

    return fig_export.build_figure()

  File "./script", line 977, in build_figure

    self.add_panels_to_page(panels_json, image_ids, page)

  File "./script", line 1803, in add_panels_to_page

    image, pil_img = self.draw_panel(panel, page, i)

  File "./script", line 1634, in draw_panel

    self.paste_image(pil_img, img_name, panel, page, dpi)

  File "./script", line 2055, in paste_image

    ShapeToPilExport(pil_img, panel, crop)

  File "./script", line 522, in __init__

    super(ShapeToPilExport, self).__init__(panel)

  File "./script", line 187, in __init__

    getattr(self, 'draw_%s' % s['type'].lower(), lambda s: None)(s)

  File "./script", line 641, in draw_rectangle

    stroke_width = scale_to_export_dpi(shape.get('strokeWidth', 2))

  File "./script", line 111, in scale_to_export_dpi

    return pixels * 300//72

TypeError: unsupported operand type(s) for //: 'str' and 'int'

A fixed proposed here address it directly in the Export script. Not sure if it's possible to fix it earlier at the Figure_JSON level.

jburel commented 3 years ago

Replaced by #426