magicalraccoon / tootstream

A command line interface for interacting with Mastodon instances
MIT License
259 stars 32 forks source link

crash on "blank notifications" #167

Open nydel opened 6 years ago

nydel commented 6 years ago

tootstream crashes when encountering what i have referred to as "blank notifications" ... here is the traceback:

(having called 'notes' from the REPL)

note: 70376 @(user-removed) favorited your status: β™Ί:0 β™₯:1 id:23 vis:🌎 via β—† Tootdon β—† 2018-01-23 02:06:41 (19 hours ago) @(user-removed) you make good points and are clearly thoughtful and think critically. and my further thoughts are - what you say suggests a problem/solution which is better than my simple whinging about progress not being made fast enough. moving from feedlot chicken-nugget tv dinner ft. ambient petroleum byproduct toward a more harmonious farming is more concrete. but is it more realistic? without leaving omnivorousness behind, can we supply the demand in a more ethical way, or is it too high?

note: 70386 Traceback (most recent call last): File "/home/nydel/ve/dev/tootstream/bin/tootstream", line 11, in load_entry_point('tootstream==0.3.1', 'console_scripts', 'tootstream')() File "/home/nydel/ve/dev/tootstream/lib/python3.5/site-packages/click-6.7-py3.5.egg/click/core.py", line 722, in call return self.main(args, kwargs) File "/home/nydel/ve/dev/tootstream/lib/python3.5/site-packages/click-6.7-py3.5.egg/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/nydel/ve/dev/tootstream/lib/python3.5/site-packages/click-6.7-py3.5.egg/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/nydel/ve/dev/tootstream/lib/python3.5/site-packages/click-6.7-py3.5.egg/click/core.py", line 535, in invoke return callback(args, **kwargs) File "/home/nydel/ve/dev/tootstream/lib/python3.5/site-packages/tootstream-0.3.1-py3.5.egg/tootstream/toot.py", line 1566, in main File "/home/nydel/ve/dev/tootstream/lib/python3.5/site-packages/tootstream-0.3.1-py3.5.egg/tootstream/toot.py", line 1015, in note TypeError: 'NoneType' object is not subscriptable (tootstream) nydel@foresee:~/ve/dev/tootstream$

the very next note that would be displayed is the "blank notification"

craigmaloney commented 6 years ago

Would you check this with version 0.3.2 of Tootstream? The streaming API changed for Mastodon.py and that may solve the issue.

Thanks!

nydel commented 6 years ago

new ve & new pip installation -- after calling notes (a few notes are displayed then...)

note: 70386 Traceback (most recent call last): File "/home/nydel/ve/ts/bin/tootstream", line 11, in sys.exit(main()) File "/home/nydel/ve/ts/lib/python3.5/site-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/home/nydel/ve/ts/lib/python3.5/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/nydel/ve/ts/lib/python3.5/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/nydel/ve/ts/lib/python3.5/site-packages/click/core.py", line 535, in invoke return callback(args, **kwargs) File "/home/nydel/ve/ts/lib/python3.5/site-packages/tootstream/toot.py", line 1665, in main cmd_func(mastodon, rest) File "/home/nydel/ve/ts/lib/python3.5/site-packages/tootstream/toot.py", line 1114, in note tz_info = note['status']['created_at'].tzinfo TypeError: 'NoneType' object is not subscriptable (ts) nydel@foresee:~/ve/ts$

craigmaloney commented 6 years ago

So it looks like 'created_at' isn''t getting set for that notification. Hurm. That's strange.

Would it be possible to run the following:

python -m pdb `which tootstream`, type "c" to continue, type note and then type p note['status'] to see what is getting returned?

nydel commented 6 years ago

note: 70386 Traceback (most recent call last): File "/usr/lib/python3.5/pdb.py", line 1661, in main pdb._runscript(mainpyfile) File "/usr/lib/python3.5/pdb.py", line 1542, in _runscript self.run(statement) File "/usr/lib/python3.5/bdb.py", line 431, in run exec(cmd, globals, locals) File "", line 1, in File "/home/nydel/ve/ts/bin/tootstream", line 4, in import re File "/home/nydel/ve/ts/lib/python3.5/site-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/home/nydel/ve/ts/lib/python3.5/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/nydel/ve/ts/lib/python3.5/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/nydel/ve/ts/lib/python3.5/site-packages/click/core.py", line 535, in invoke return callback(args, **kwargs) File "/home/nydel/ve/ts/lib/python3.5/site-packages/tootstream/toot.py", line 1665, in main cmd_func(mastodon, rest) File "/home/nydel/ve/ts/lib/python3.5/site-packages/tootstream/toot.py", line 1114, in note tz_info = note['status']['created_at'].tzinfo TypeError: 'NoneType' object is not subscriptable Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program

/home/nydel/ve/ts/lib/python3.5/site-packages/tootstream/toot.py(1114)note() -> tz_info = note['status']['created_at'].tzinfo (Pdb) p note['status'] None (Pdb) p note['created_at'] datetime.datetime(2018, 1, 23, 3, 11, 36, 214000, tzinfo=tzutc()) (Pdb)

craigmaloney commented 6 years ago

09773300428952175019fac06e2441ce45fa4195 adds a generic exception handling routine for crashes like this. It's not the best solution but it should prevent it from crashing. I'll still give this a peek for future versions.

magicalraccoon commented 6 years ago

Are we still having errors with this? I haven't seen anything on my end.