prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Unhandled error in plugin exists: 'PosixPath' object has no attribute 'walk'
  <!---
  Before opening an issue, verify:
  
  - Is this a feature request? Post it on https://feathub.com/Flexget/Flexget
  - Did you recently upgrade? Look at the Change Log and Upgrade Actions to make sure that you don't need to make any changes to your config https://flexget.com/ChangeLog https://flexget.com/UpgradeActions
  - Are you running FlexGet as a daemon? Stop it completely and then start it again https://flexget.com/CLI/daemon
  - Did you search to see if the issue already exists? https://github.com/Flexget/Flexget/issues
  - Did you fill out the issue template as completely as possible?
  
  The issue template is here because it helps to ensure you submitted all the necessary information the first time, and allows us to more quickly review issues. Please fill it out correctly and do not ignore it, no matter how irrelevant you think it may be. Thanks in advance for your help with this!
  --->
  
  ### Expected behaviour:
  After daemon startup, tasks are run without errors
  <!---
  Please don't just say "it doesn't crash" or "it works". Explain what the expected result is.
  --->
  
  ### Actual behaviour:
  Tasks are aborted
  ### Steps to reproduce:
  - Step 1: Configure exists plugin
  - Step 2: Run flexget
  
  #### Config:
  AFAIR, any config using exists plugin
    
  #### Log:
  <details>
   <summary>(click to expand)</summary>
  
  ```
  2019-11-13 20:32 CRITICAL task          tv_rarbg        BUG: Unhandled error in plugin exists: 'PosixPath' object has no attribute 'walk'
  Traceback (most recent call last):
    File "/home/carno/envs/flexget3/lib/python3.7/site-packages/flexget/task.py", line 520, in __run_plugin
      result = method(*args, **kwargs)
    File "/home/carno/envs/flexget3/lib/python3.7/site-packages/flexget/event.py", line 20, in __call__
      return self.func(*args, **kwargs)
    File "/home/carno/envs/flexget3/lib/python3.7/site-packages/flexget/plugins/filter/exists.py", line 41, in on_task_filter
      for p in folder.walk(errors='ignore'):
  AttributeError: 'PosixPath' object has no attribute 'walk'
  
  ```
  </details>
  
  ### Additional information:
  
  - FlexGet version: 3.0.1
  - Python version: 3.7.2
  - Installation method: pip
  - Using daemon (yes/no): yes
  - OS and version: debian unstable
  - Link to crash log: N/A
  
  <!---
  In config and debug/crash logs, remember to redact any personal or sensitive information such as passwords, API keys, private URLs and so on.
  
  Please verify that the following data is present before submitting your issue:
  
  - Link to a paste service or paste above the relevant config (preferably full config, including templates if present). Please make sure the paste does not expire, if possible.
  - Link to a paste service or paste above debug-level logs of the relevant task/s (use `flexget -L debug execute --tasks <Task_name>`).
  - FlexGet version (use `flexget -V` to get it).
  - Full Python version, for example `2.7.11` (use `python -V` to get it). 
  - Installation method (pip, git install, etc).
  - Whether or not you're running FlexGet as a daemon.
  - OS and version.
  - Attach crash log if one was generated, in addition to the debug-level log. It can be found in the directory with your config file.
  --->
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `flexget/plugins/filter/exists.py`
  Content:
  ```
  1 import logging
  2 import platform
  3 from pathlib import Path
  4 
  5 from flexget import plugin
  6 from flexget.config_schema import one_or_more
  7 from flexget.event import event
  8 
  9 log = logging.getLogger('exists')
  10 
  11 
  12 class FilterExists:
  13     """
  14         Reject entries that already exist in given path.
  15 
  16         Example::
  17 
  18           exists: /storage/movies/
  19     """
  20 
  21     schema = one_or_more({'type': 'string', 'format': 'path'})
  22 
  23     def prepare_config(self, config):
  24         # If only a single path is passed turn it into a 1 element list
  25         if isinstance(config, str):
  26             config = [config]
  27         return config
  28 
  29     @plugin.priority(-1)
  30     def on_task_filter(self, task, config):
  31         if not task.accepted:
  32             log.debug('No accepted entries, not scanning for existing.')
  33             return
  34         log.verbose('Scanning path(s) for existing files.')
  35         config = self.prepare_config(config)
  36         filenames = {}
  37         for folder in config:
  38             folder = Path(folder).expanduser()
  39             if not folder.exists():
  40                 raise plugin.PluginWarning('Path %s does not exist' % folder, log)
  41             for p in folder.walk(errors='ignore'):
  42                 key = p.name
  43                 # windows file system is not case sensitive
  44                 if platform.system() == 'Windows':
  45                     key = key.lower()
  46                 filenames[key] = p
  47         for entry in task.accepted:
  48             # priority is: filename, location (filename only), title
  49             name = Path(entry.get('filename', entry.get('location', entry['title']))).name
  50             if platform.system() == 'Windows':
  51                 name = name.lower()
  52             if name in filenames:
  53                 log.debug('Found %s in %s' % (name, filenames[name]))
  54                 entry.reject('exists in %s' % filenames[name])
  55 
  56 
  57 @event('plugin.register')
  58 def register_plugin():
  59     plugin.register(FilterExists, 'exists', api_ver=2)
  60
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/flexget/plugins/filter/exists.py b/flexget/plugins/filter/exists.py
  --- a/flexget/plugins/filter/exists.py
  +++ b/flexget/plugins/filter/exists.py
  @@ -38,12 +38,13 @@
               folder = Path(folder).expanduser()
               if not folder.exists():
                   raise plugin.PluginWarning('Path %s does not exist' % folder, log)
  -            for p in folder.walk(errors='ignore'):
  -                key = p.name
  -                # windows file system is not case sensitive
  -                if platform.system() == 'Windows':
  -                    key = key.lower()
  -                filenames[key] = p
  +            for p in folder.rglob('*'):
  +                if p.is_file():
  +                    key = p.name
  +                    # windows file system is not case sensitive
  +                    if platform.system() == 'Windows':
  +                        key = key.lower()
  +                    filenames[key] = p
           for entry in task.accepted:
               # priority is: filename, location (filename only), title
               name = Path(entry.get('filename', entry.get('location', entry['title']))).name
  
verification_info: {"golden_diff": "diff --git a/flexget/plugins/filter/exists.py b/flexget/plugins/filter/exists.py\n--- a/flexget/plugins/filter/exists.py\n+++ b/flexget/plugins/filter/exists.py\n@@ -38,12 +38,13 @@\n             folder = Path(folder).expanduser()\n             if not folder.exists():\n                 raise plugin.PluginWarning('Path %s does not exist' % folder, log)\n-            for p in folder.walk(errors='ignore'):\n-                key = p.name\n-                # windows file system is not case sensitive\n-                if platform.system() == 'Windows':\n-                    key = key.lower()\n-                filenames[key] = p\n+            for p in folder.rglob('*'):\n+                if p.is_file():\n+                    key = p.name\n+                    # windows file system is not case sensitive\n+                    if platform.system() == 'Windows':\n+                        key = key.lower()\n+                    filenames[key] = p\n         for entry in task.accepted:\n             # priority is: filename, location (filename only), title\n             name = Path(entry.get('filename', entry.get('location', entry['title']))).name\n", "issue": "Unhandled error in plugin exists: 'PosixPath' object has no attribute 'walk'\n<!---\r\nBefore opening an issue, verify:\r\n\r\n- Is this a feature request? Post it on https://feathub.com/Flexget/Flexget\r\n- Did you recently upgrade? Look at the Change Log and Upgrade Actions to make sure that you don't need to make any changes to your config https://flexget.com/ChangeLog https://flexget.com/UpgradeActions\r\n- Are you running FlexGet as a daemon? Stop it completely and then start it again https://flexget.com/CLI/daemon\r\n- Did you search to see if the issue already exists? https://github.com/Flexget/Flexget/issues\r\n- Did you fill out the issue template as completely as possible?\r\n\r\nThe issue template is here because it helps to ensure you submitted all the necessary information the first time, and allows us to more quickly review issues. Please fill it out correctly and do not ignore it, no matter how irrelevant you think it may be. Thanks in advance for your help with this!\r\n--->\r\n\r\n### Expected behaviour:\r\nAfter daemon startup, tasks are run without errors\r\n<!---\r\nPlease don't just say \"it doesn't crash\" or \"it works\". Explain what the expected result is.\r\n--->\r\n\r\n### Actual behaviour:\r\nTasks are aborted\r\n### Steps to reproduce:\r\n- Step 1: Configure exists plugin\r\n- Step 2: Run flexget\r\n\r\n#### Config:\r\nAFAIR, any config using exists plugin\r\n  \r\n#### Log:\r\n<details>\r\n <summary>(click to expand)</summary>\r\n\r\n```\r\n2019-11-13 20:32 CRITICAL task          tv_rarbg        BUG: Unhandled error in plugin exists: 'PosixPath' object has no attribute 'walk'\r\nTraceback (most recent call last):\r\n  File \"/home/carno/envs/flexget3/lib/python3.7/site-packages/flexget/task.py\", line 520, in __run_plugin\r\n    result = method(*args, **kwargs)\r\n  File \"/home/carno/envs/flexget3/lib/python3.7/site-packages/flexget/event.py\", line 20, in __call__\r\n    return self.func(*args, **kwargs)\r\n  File \"/home/carno/envs/flexget3/lib/python3.7/site-packages/flexget/plugins/filter/exists.py\", line 41, in on_task_filter\r\n    for p in folder.walk(errors='ignore'):\r\nAttributeError: 'PosixPath' object has no attribute 'walk'\r\n\r\n```\r\n</details>\r\n\r\n### Additional information:\r\n\r\n- FlexGet version: 3.0.1\r\n- Python version: 3.7.2\r\n- Installation method: pip\r\n- Using daemon (yes/no): yes\r\n- OS and version: debian unstable\r\n- Link to crash log: N/A\r\n\r\n<!---\r\nIn config and debug/crash logs, remember to redact any personal or sensitive information such as passwords, API keys, private URLs and so on.\r\n\r\nPlease verify that the following data is present before submitting your issue:\r\n\r\n- Link to a paste service or paste above the relevant config (preferably full config, including templates if present). Please make sure the paste does not expire, if possible.\r\n- Link to a paste service or paste above debug-level logs of the relevant task/s (use `flexget -L debug execute --tasks <Task_name>`).\r\n- FlexGet version (use `flexget -V` to get it).\r\n- Full Python version, for example `2.7.11` (use `python -V` to get it). \r\n- Installation method (pip, git install, etc).\r\n- Whether or not you're running FlexGet as a daemon.\r\n- OS and version.\r\n- Attach crash log if one was generated, in addition to the debug-level log. It can be found in the directory with your config file.\r\n--->\r\n\n", "before_files": [{"content": "import logging\nimport platform\nfrom pathlib import Path\n\nfrom flexget import plugin\nfrom flexget.config_schema import one_or_more\nfrom flexget.event import event\n\nlog = logging.getLogger('exists')\n\n\nclass FilterExists:\n    \"\"\"\n        Reject entries that already exist in given path.\n\n        Example::\n\n          exists: /storage/movies/\n    \"\"\"\n\n    schema = one_or_more({'type': 'string', 'format': 'path'})\n\n    def prepare_config(self, config):\n        # If only a single path is passed turn it into a 1 element list\n        if isinstance(config, str):\n            config = [config]\n        return config\n\n    @plugin.priority(-1)\n    def on_task_filter(self, task, config):\n        if not task.accepted:\n            log.debug('No accepted entries, not scanning for existing.')\n            return\n        log.verbose('Scanning path(s) for existing files.')\n        config = self.prepare_config(config)\n        filenames = {}\n        for folder in config:\n            folder = Path(folder).expanduser()\n            if not folder.exists():\n                raise plugin.PluginWarning('Path %s does not exist' % folder, log)\n            for p in folder.walk(errors='ignore'):\n                key = p.name\n                # windows file system is not case sensitive\n                if platform.system() == 'Windows':\n                    key = key.lower()\n                filenames[key] = p\n        for entry in task.accepted:\n            # priority is: filename, location (filename only), title\n            name = Path(entry.get('filename', entry.get('location', entry['title']))).name\n            if platform.system() == 'Windows':\n                name = name.lower()\n            if name in filenames:\n                log.debug('Found %s in %s' % (name, filenames[name]))\n                entry.reject('exists in %s' % filenames[name])\n\n\n@event('plugin.register')\ndef register_plugin():\n    plugin.register(FilterExists, 'exists', api_ver=2)\n", "path": "flexget/plugins/filter/exists.py"}], "after_files": [{"content": "import logging\nimport platform\nfrom pathlib import Path\n\nfrom flexget import plugin\nfrom flexget.config_schema import one_or_more\nfrom flexget.event import event\n\nlog = logging.getLogger('exists')\n\n\nclass FilterExists:\n    \"\"\"\n        Reject entries that already exist in given path.\n\n        Example::\n\n          exists: /storage/movies/\n    \"\"\"\n\n    schema = one_or_more({'type': 'string', 'format': 'path'})\n\n    def prepare_config(self, config):\n        # If only a single path is passed turn it into a 1 element list\n        if isinstance(config, str):\n            config = [config]\n        return config\n\n    @plugin.priority(-1)\n    def on_task_filter(self, task, config):\n        if not task.accepted:\n            log.debug('No accepted entries, not scanning for existing.')\n            return\n        log.verbose('Scanning path(s) for existing files.')\n        config = self.prepare_config(config)\n        filenames = {}\n        for folder in config:\n            folder = Path(folder).expanduser()\n            if not folder.exists():\n                raise plugin.PluginWarning('Path %s does not exist' % folder, log)\n            for p in folder.rglob('*'):\n                if p.is_file():\n                    key = p.name\n                    # windows file system is not case sensitive\n                    if platform.system() == 'Windows':\n                        key = key.lower()\n                    filenames[key] = p\n        for entry in task.accepted:\n            # priority is: filename, location (filename only), title\n            name = Path(entry.get('filename', entry.get('location', entry['title']))).name\n            if platform.system() == 'Windows':\n                name = name.lower()\n            if name in filenames:\n                log.debug('Found %s in %s' % (name, filenames[name]))\n                entry.reject('exists in %s' % filenames[name])\n\n\n@event('plugin.register')\ndef register_plugin():\n    plugin.register(FilterExists, 'exists', api_ver=2)\n", "path": "flexget/plugins/filter/exists.py"}]}