OZtree icon indicating copy to clipboard operation
OZtree copied to clipboard

invalid literal for int() in resolve_pinpoint_to_row

Open hyanwong opened this issue 1 year ago • 2 comments

I'm seeing this in the logs:

<class 'ValueError'> invalid literal for int() with base 10: 'Melainabacteria_group=5268478'
Traceback (most recent call last):
  File "/usr/home/web2py/www.onezoom.org/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "/usr/home/web2py/www.onezoom.org/applications/OZtree/compiled/controllers.API.pinpoints.py", line 896, in <module>
  File "/usr/home/web2py/www.onezoom.org/gluon/globals.py", line 463, in <lambda>
    self._caller = lambda f: f()
  File "/usr/home/web2py/www.onezoom.org/applications/OZtree/compiled/controllers.API.pinpoints.py", line 148, in pinpoints
  File "/usr/home/web2py/www.onezoom.org/applications/OZtree/modules/pinpoint.py", line 61, in resolve_pinpoint_to_row
    node_query = db.ordered_nodes.ott == int(pinpoint)

hyanwong avatar May 04 '24 12:05 hyanwong

5268478 is Cyanobacteria/Melainabacteria group. Initial thought is that the slash in the pseudo-taxon is throwing something off.

In the newick, it looks like 'Cyanobacteria/Melainabacteria_group_ott5268478'.

That being said, there are quite a few entries with a /, so maybe there is more to it.

davidebbo avatar May 04 '24 17:05 davidebbo

The slash is a very good point. A URL like https://beta.onezoom.org/API/pinpoints.json/@Cyanobacteria/Melainabacteria_group=5268478 goes bang in the way you'd expect. We try and treat each half as a pinpoint, and the latter half doesn't look like a valid OTT:

https://github.com/OneZoom/OZtree/blob/fa65779fcd6a37cd6658e3fd21b07568ea023a17/modules/pinpoint.py#L59-L62

There's not that much that can be done within the API. The damage is done by this point, so we'd need to figure out what's calling it with a malformed URL.

lentinj avatar May 07 '24 09:05 lentinj