-
Notifications
You must be signed in to change notification settings - Fork 33
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
TypeError: 'NoneType' object is not subscriptable #106
Comments
Strange! Do you have an idea of how this can happen? An empty status somehow?
|
Il 13/07/23 13:33, Alex Schroeder ha scritto:
Strange! Do you have an idea of how this can happen? An empty status somehow?
I don't know, but I suspect my instance has enabled a data retention
policy and that for this reason some fields are empty (for example
replies no longer mention their parent post). That "feature" is very brutal:
mastodon/mastodon#19232
|
I guess that means double-checking for the existence of all the attributes the code simply assumes to be there. How annoying. Ugh.
|
@nemobis Want to try something like this? It's untested on my end, but since you have a setup that is probably full of random holes, perhaps we can uncover and handle all the common cases. index 16ff94a..a34fef7 100644
--- a/mastodon_archive/context.py
+++ b/mastodon_archive/context.py
@@ -46,6 +46,9 @@ def context(args):
print("Indexing %d %s..." % (len(statuses), collection))
for status in statuses:
+ if status is None:
+ continue;
+
if status["reblog"] is not None:
status = status["reblog"]
To be honest, I'm not quite sure I totally understand the problem. The feature is this:
But you're running code that wants to show the context of a toot, based on the archive you already downloaded. So the archive contains statuses that are "nothing"? I don't even know how that would work. How does the JSON file represent this? Thus, an alternative would be this: find instances of |
Inspired by your previous answer, I changed
to:
But I think it might be better to remove them from |
Hm. I guess we need to decide what to do about the nulls. Keep them in the archive? In that case we need to handle all the uses of the statuses (like your suggestion). Or remove them from the archive? And prevent them from getting added? Perhaps that brings with it more problems. Gaaaah. |
I started making a lot of changes for all instances of |
With version 1.4.2 installed from pip and mamot.fr running on Mastodon v4.1.3, most commands work but some fail with TypeError like:
The text was updated successfully, but these errors were encountered: