Closed eminaksehirli closed 8 years ago
Good catch, thanks!
But I believe a better solution, instead of creating and testing a new var, would be to simply add another except
block. Something like this, right after the first except IOError as e: log.error(e)
:
except AttributeError as e:
log.warn("No credentials found in keyring. First use?")
If you can do this change (and amend/rebase to a single commit) I will gladly pull it, so you get all the credit. If not, I can do it myself in a week.
And once again, thanks!
A new variable looks ugly indeed and that's why this change has been in my "uncommitted changes" for over a month. However, initialization is not an "exception" and it would be conceptually wrong to treat it so. I will open an issue and let you decide how to solve. Credits are not important. Btw, thank you for project, it works beautifully.
Cheers,
It's not conceptually wrong to handle it as an exception: exceptions are not necessarily "errors", specially in Python. They're just... exceptional events, ie, not the regular cases. And first-time initialization most certainly qualifies as an exceptional event :) As important as it is, it's still a 1-time only thing. So I believe an Exception is the most elegant, "pythonic" way to handle that.
That said, what exactly is the exception generated on first run? I believe it's AttributeError
due to the attempt of performing .split()
on None
. If so, I can fix this right away
Fixed on f5ad680, thanks!
It doesn't fail any more on initial start because the keyring is not there.