Skip to content

BUG: Unhandled error in plugin rtorrent: local variable 'e' referenced before assignment #1669

@ryd994

Description

@ryd994

Expected behaviour:

Torrent get added

Actual behaviour:

flexget crashed

Steps to reproduce:

  • Step 1: Add torrent to rtorrent with the rtorrent plugin

Config:

 sumisora:
    rss: https://share.dmhy.org/topics/rss/rss.xml?team_id=58
    accept_all: yes
    rtorrent:
      uri: scgi://localhost:5000
      path: /root/sumisora

Log:

2017-02-04 17:03 CRITICAL task          sumisora-dmhy   BUG: Unhandled error in plugin rtorrent: local variable 'e' referenced before assignment
Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/flexget/task.py", line 483, in __run_plugin
    return method(*args, **kwargs)
  File "/usr/lib64/python3.5/site-packages/flexget/event.py", line 23, in __call__
    return self.func(*args, **kwargs)
  File "/usr/lib64/python3.5/site-packages/flexget/plugins/clients/rtorrent.py", line 530, in on_task_output
    self.add_entry(client, entry, options, start=config['start'], mkdir=config['mkdir'])
  File "/usr/lib64/python3.5/site-packages/flexget/plugins/clients/rtorrent.py", line 652, in add_entry
    self._verify_load(client, entry['torrent_info_hash'])
  File "/usr/lib64/python3.5/site-packages/flexget/plugins/clients/rtorrent.py", line 500, in _verify_load
    raise e
UnboundLocalError: local variable 'e' referenced before assignment

Additional information:

  • Flexget Version:2.9.14
  • Python Version: Python 3.5.2
  • Installation method: pip
  • OS and version:Fedora 25
  • Link to crash log:

I digged into this issue a bit:
The error is in flexget/plugins/clients/rtorrent.py:500

    def _verify_load(self, client, info_hash):
        e = IOError()
        for _ in range(0, 5):
            try:
                return client.torrent(info_hash, fields=['hash'])
            except (IOError, xmlrpc_client.Error) as e:
                sleep(0.5)
        raise e

In python3, e will be deleted. Ref: http://stackoverflow.com/questions/15077506/received-unboundlocalerror-local-variable-e-referenced-before-assignment-wh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions