ffnord / mesh-announce

Discussion at #mesh-announce:irc.hackint.org and (separately) at
https://matrix.to/#/!MjLIHcALOcENXZWQlH:irc.hackint.org/$1547640760901FmKaD:matrix.eclabs.de
13 stars 45 forks source link

ValueError: invalid literal for int() with base 10: '10000.0' #88

Open maurerle opened 1 year ago

maurerle commented 1 year ago

Casting the string directly to an int fails using BATMAN_V when i set up routing between two supernodes:

Feb 18 17:45:30 respondd.py[770]: Traceback (most recent call last):
Feb 18 17:45:30 respondd.py[770]:   File "/opt/mesh-announce/providers/__init__.py", line 153, in call
Feb 18 17:45:30 respondd.py[770]:     _set_value(ret, source.path, source.call(env))
Feb 18 17:45:30 respondd.py[770]:   File "/opt/mesh-announce/providers/__init__.py", line 118, in call
Feb 18 17:45:30 respondd.py[770]:     result = self.source.call(*args)
Feb 18 17:45:30 respondd.py[770]:   File "/opt/mesh-announce/providers/neighbours/batadv.py", line 23, in call
Feb 18 17:45:30 respondd.py[770]:     ifneighbours[fields[0]] = {'lastseen': float(fields[1].strip('s')), 'tq': int(fields[2])}
Feb 18 17:45:30 respondd.py[770]: ValueError: invalid literal for int() with base 10: '10000.0'

I think we need to have something like int(float('10000.0')) instead here

jplitza commented 1 month ago

I guess we should use batctl originators_json instead of batctl origintators, which would probably solve this problem, too.