For some reason, I was getting this backtrace here when running a test
feed:
plugin generated exception: expected str, bytes or os.PathLike object, not NoneType, skipping
Traceback (most recent call last):
File "/home/anarcat/src/feed2exec/feed2exec/plugins/__init__.py", line 105, in output
return plugin.output(*args, feed=feed, item=item, lock=lock)
File "/home/anarcat/src/feed2exec/feed2exec/plugins/maildir.py", line 42, in __init__
prefix = os.path.expanduser(feed.get('mailbox', '~/Maildir'))
File "/usr/lib/python3.7/posixpath.py", line 235, in expanduser
path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
This was caused by the maildir plugin constructor, which was looking
up the `mailbox` field in the field. Because that is unset in my
feed2exec.ini (because I was testing against a new feed), that
`mailbox` key was just not present. The feedparser dict behavior in
this case is to return None, instead of the default, which I find
strange and unusual.
Tests still seem to pass here after the patch, so I guess this should
work in the future, and does un-break the feed test.
I can't quite figure out how to come up with a unit test for that one,
but now I can't help but think that feed configuration should just be
split up from the feedparser dict, because so much of those issues
come from that (strange) coupling.
↧