Skip to content

Crash when "defaults" not specified in config #9

sampsyo opened this Issue Nov 16, 2011 · 3 comments

2 participants

sampsyo commented Nov 16, 2011

If the user doesn't have a "defaults" dict in config.yaml, the defaults field on the Config object is None because this method returns None implicitly:

Then, later, when a config value is looked up, defaults is assumed to exist:

This raises a "TypeError: 'NoneType' object is not subscriptable" error, which is not handled. You probably want this somewhere in there:

if not self.defaults:
     return False

@sampsyo thanks for reporting this and #8. I'll push a fix for this tonight but it's made me realise that I need to make the config module cope with no defaults in a more sane way.

sampsyo commented Nov 16, 2011

Cool! That makes sense. And thanks for all your work on this project; it's definitely the most straightforward implementation in the "TV episode rename" category that I've seen so far. :)

@ghickman ghickman added a commit that closed this issue Nov 16, 2011
@ghickman Return a more sensible output when the config's defaults are missing
This is a stop gap for now as no defaults shouldn't really cause the
program to exit, but ideally would have some inbuilt defaults to cope
with a situation like this. Either in the code or in a config included
with the code to make it more modular. I'll expand on this in #10.

Fixes #9
@ghickman ghickman closed this in c84ede4 Nov 16, 2011

I've released to the PyPI too =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.