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

Bug: render scaled region: various issues #453

Open
will-moore opened this issue Dec 7, 2021 · 3 comments
Open

Bug: render scaled region: various issues #453

will-moore opened this issue Dec 7, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@will-moore
Copy link
Member

Seen on IDR:

Traceback (most recent call last):
...

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omero_figure/views.py", line 203, in render_scaled_region
    canvas = Image.new("RGB", (width, height), (221, 221, 221))

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/PIL/Image.py", line 2698, in new
    return im._new(core.fill(mode, size, color))

TypeError: integer argument expected, got float

<WSGIRequest: GET '/figure/render_scaled_region/9836998/71/0/?c=1%7C3:246$00FF00,2%7C6:133$FF0000&maps=[%7B%22reverse%22:%7B%22enabled%22:false%7D%7D,%7B%22reverse%22:%7B%22enabled%22:false%7D%7D]&region=158,5,1267,787&m=c'>
@will-moore
Copy link
Member Author

Seen again today:

Internal Server Error: /figure/render_scaled_region/4506345/0/0/

TypeError at /figure/render_scaled_region/4506345/0/0/
integer argument expected, got float

Request Method: GET
Request URL: https://nightshade.openmicroscopy.org/figure/render_scaled_region/4506345/0/0/?c=1%7C632:17257$FF0000,2%7C435:23984$00FF00,3%7C8119:27076$0000FF&maps=[%7B%22reverse%22:%7B%22enabled%22:false%7D%7D,%7B%22reverse%22:%7B%22enabled%22:false%7D%7D,%7B%22reverse%22:%7B%22enabled%22:false%7D%7D]&region=-860,-860,5160,5160&m=c
Django Version: 3.2.12
Python Executable: /opt/omero/web/venv3/bin/python3

...
  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 538, in wrapped
    retval = f(request, *args, **kwargs)
  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omero_figure/views.py", line 203, in render_scaled_region
    canvas = Image.new("RGB", (width, height), (221, 221, 221))
  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/PIL/Image.py", line 2544, in new
    return im._new(core.fill(mode, size, color))

Exception Type: TypeError at /figure/render_scaled_region/4506345/0/0/
Exception Value: integer argument expected, got float

@will-moore will-moore added the bug Something isn't working label Apr 21, 2022
@will-moore will-moore changed the title Bug: render scaled region: integer argument expected, got float Bug: render scaled region: various issues Jun 29, 2022
@will-moore
Copy link
Member Author

Seen on nightshade just now:
/figure/render_scaled_region/4486420/0/0/?region=NaN,NaN,7156,7156

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omero_figure/views.py", line 191, in render_scaled_region
    x = int(x * scale)

ValueError: cannot convert float NaN to integer

will-moore added a commit to will-moore/figure that referenced this issue Jul 7, 2022
Hopefully fix rare cases of x or y is NaN e.g. ome#453 (comment)
@will-moore
Copy link
Member Author

https://www.openmicroscopy.org/qa2/qa/feedback/37359/

If ?region=0,0,1024,1024 is missing, should return 404 instead of Error:

Traceback (most recent call last):

File "/opt/omero/web/venv3/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)

File "/opt/omero/web/venv3/lib64/python3.6/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 538, in wrapped
retval = f(request, *args, **kwargs)

File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omero_figure/views.py", line 181, in render_scaled_region
x, y, width, height = [float(r) for r in region.split(',')]

AttributeError: 'NoneType' object has no attribute 'split'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant