Skip to content
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

Preparing for no files key when magnetizing #1752

Merged
merged 1 commit into from
Mar 24, 2017

Conversation

BackSlasher
Copy link
Contributor

Motivation for changes:

  • I had torrent adding exceptions when waiting on magnetization. Torrent was actually added, so it's not showstopping, but feature is still defective.

Detailed changes:

  • Will supply default value of [] when trying to access status['files'], which might not exist.
  • Also made line a bit more Pythonic

Addressed issues:

This is the error I had.

2017-03-24 10:23 INFO     deluge        download_tv     REDACTED was not added to deluge! [Failure instance: Traceback: <type 'exceptions.KeyError'>: u'files'\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:393:callback\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:501:_startRunCallbacks\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:588:_runCallbacks\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1184:gotResult\n--- <exception caught here> ---\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1128:_inlineCallbacks\n/srv/seedbox/flexget-venv/local/lib/python2.7/site-packages/flexget/plugins/clients/deluge.py:744:_wait_for_metadata\n]

TODO

Line can also be:

if ('files' in status) and len(status['files']):

I have no strong opinion in either way.

Copy link
Member

@liiight liiight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you could just do

If status.get('files'):

@BackSlasher
Copy link
Contributor Author

Sure why not

Now prepared for the fact that `status` may not contain `files` before magnetization
also a bit more Pythonic
@liiight liiight merged commit d54ed5a into Flexget:develop Mar 24, 2017
@BackSlasher BackSlasher deleted the patch-2 branch March 24, 2017 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants