Traceback (most recent call last):
File "/opt/mastodon_digest/run.py", line 190, in <module>
run(
File "/opt/mastodon_digest/run.py", line 70, in run
threshold_posts = threshold.posts_meeting_criteria(posts, scorer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/mastodon_digest/thresholds.py", line 26, in posts_meeting_criteria
all_post_scores = [p.get_score(scorer) for p in posts]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/mastodon_digest/thresholds.py", line 26, in <listcomp>
all_post_scores = [p.get_score(scorer) for p in posts]
^^^^^^^^^^^^^^^^^^^
File "/opt/mastodon_digest/models.py", line 21, in get_score
return scorer.score(self)
^^^^^^^^^^^^^^^^^^
File "/opt/mastodon_digest/scorers.py", line 75, in score
return super().score(scored_post) * super().weight(scored_post)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/mastodon_digest/scorers.py", line 38, in weight
weight = 1 / sqrt(scored_post.info["account"]["followers_count"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: math domain error
By adding debug info to scored_post.info["account"]["followers_count"] I noticed that indeed I'm following an account which has hidden its number of followers:
Therefore, followers_count=-1 and the sqrt fails
I haven't read the algorithm yet to suggest what's the reasonable thing to do in this case. Perhaps someone will be quicker than me :)
Using the default options I noticed this error:
Bug is on this line: https://github.com/hodgesmr/mastodon_digest/blob/f70a01896e9b69e05803f6be1cd863e1ffc630b8/scorers.py#L36
By adding debug info to
scored_post.info["account"]["followers_count"]
I noticed that indeed I'm following an account which has hidden its number of followers:Therefore,
followers_count=-1
and thesqrt
failsI haven't read the algorithm yet to suggest what's the reasonable thing to do in this case. Perhaps someone will be quicker than me :)