# Buggy code
def discard(self, entry):
    if self.config["list"] in IMMUTABLE_LISTS:
        raise plugin.PluginError(
            "%s lists are not modifiable" % " and ".join(IMMUTABLE_LISTS)
        )
    if "imdb_id" not in entry:
        log.warning(
            "Cannot remove %s from imdb_list because it does not have an imdb_id",
            entry["title"],
        )
        return
    # Get the list item id
    item_ids = None
    if self.config["list"] == "watchlist":
        data = {"consts[]": entry["imdb_id"], "tracking_tag": "watchlistRibbon"}
        status = self.session.post(
            "http://www.imdb.com/list/_ajax/watchlist_has", data=data
        ).json()
        item_ids = status.get("has", {}).get(entry["imdb_id"])
    else:
        data = {"tconst": entry["imdb_id"]}
        status = self.session.post(
            "http://www.imdb.com/list/_ajax/wlb_dropdown", data=data
        ).json()
        for a_list in status["items"]:
            if a_list["data_list_id"] == self.list_id:
                item_ids = a_list["data_list_item_ids"]
                break
    if not item_ids:
        log.warning(
            "%s is not in list %s, cannot be removed", entry["imdb_id"], self.list_id
        )
        return
    data = {"action": "delete", "list_id": self.list_id, "ref_tag": "title"}
    for item_id in item_ids:
        self.session.post(
            "http://www.imdb.com/list/_ajax/edit", data=dict(data, list_item_id=item_id)
        )
    # We don't need to invalidate our cache if we remove the item
    self._items = [i for i in self._items if i["imdb_id"] != entry["imdb_id"]]


# Traceback (TypeError)
2016-04-11 20:53 DEBUG    manager       imdb            Traceback:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flexget\task.py", line 438, in __run_plugin
return method(*args, **kwargs)
File "c:\python27\lib\site-packages\flexget\event.py", line 22, in __call__
return self.func(*args, **kwargs)
File "c:\python27\lib\site-packages\flexget\plugins\output\list_remove.py", line 36, in on_task_output
thelist -= task.accepted
File "c:\python27\lib\_abcoll.py", line 356, in __isub__
self.discard(value)
File "c:\python27\lib\site-packages\flexget\plugins\list\imdb_list.py", line 173, in discard
self._items = [i for i in self._items if i['imdb_id'] != entry['imdb_id']]
TypeError: 'NoneType' object is not iterable

# Fixed code
def discard(self, entry):
    if self.config["list"] in IMMUTABLE_LISTS:
        raise plugin.PluginError(
            "%s lists are not modifiable" % " and ".join(IMMUTABLE_LISTS)
        )
    if "imdb_id" not in entry:
        log.warning(
            "Cannot remove %s from imdb_list because it does not have an imdb_id",
            entry["title"],
        )
        return
    # Get the list item id
    item_ids = None
    if self.config["list"] == "watchlist":
        data = {"consts[]": entry["imdb_id"], "tracking_tag": "watchlistRibbon"}
        status = self.session.post(
            "http://www.imdb.com/list/_ajax/watchlist_has", data=data
        ).json()
        item_ids = status.get("has", {}).get(entry["imdb_id"])
    else:
        data = {"tconst": entry["imdb_id"]}
        status = self.session.post(
            "http://www.imdb.com/list/_ajax/wlb_dropdown", data=data
        ).json()
        for a_list in status["items"]:
            if a_list["data_list_id"] == self.list_id:
                item_ids = a_list["data_list_item_ids"]
                break
    if not item_ids:
        log.warning(
            "%s is not in list %s, cannot be removed", entry["imdb_id"], self.list_id
        )
        return
    data = {"action": "delete", "list_id": self.list_id, "ref_tag": "title"}
    for item_id in item_ids:
        self.session.post(
            "http://www.imdb.com/list/_ajax/edit", data=dict(data, list_item_id=item_id)
        )
    # We don't need to invalidate our cache if we remove the item
    self._items = [
        i for i in self._items if self._items and i["imdb_id"] != entry["imdb_id"]
    ]