Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unhandled error in plugin seen: 'str' object has no attribute 'tzinfo' #4024

@4oo4

Description

@4oo4

Expected behaviour: Flexget can accurately parse files' tzinfo data without crashing

Actual behaviour: Flexget crashes on certain files with 'str' object has no attribute 'tzinfo'.

Steps to reproduce:

  • Run flexget with filesystem input
  • Flexget crashes when trying to parse tzinfo of files

Config:

tasks:
  fake-task task:
    accept_all: yes
    filesystem:
      path:
        - "/home/code/.flexget-fake/inputs"
      retrieve:
        - files
        - dirs
      recursive: yes
    exists:
      - "/home/code/.flexget-fake/outputs"
    seen:
      local: yes
      fields: [title, url, content_size, modified]
    copy:
      to: '/home/code/.flexget-fake/outputs'
      allow_dir: yes
    exec:
      on_output:
        for_accepted:
          - sleep 30
          - touch /home/code/.flexget-fake/outputs/{{title}}

I am testing with the following text files, the error has also come up for me in my production config that uses a filesystem input.

~/.flexget-fake/inputs > $ tree
.
├── four
├── test
│   ├── one
│   └── two
└── three

2 directories, 4 files

Log:

(click to expand)
2024-07-23 15:09:10 DEBUG    manager                       Figuring out config load paths
2024-07-23 15:09:10 DEBUG    manager                       Found config: /home/code/.config/flexget/config.yml
2024-07-23 15:09:10 DEBUG    manager                       Config file /home/code/.config/flexget/config.yml selected
2024-07-23 15:09:10 DEBUG    manager                       sys.defaultencoding: utf-8
2024-07-23 15:09:10 DEBUG    manager                       sys.getfilesystemencoding: utf-8
2024-07-23 15:09:10 DEBUG    manager                       flexget detected io encoding: utf-8
2024-07-23 15:09:10 DEBUG    manager                       os.path.supports_unicode_filenames: False
2024-07-23 15:09:10 DEBUG    manager                       Figuring out config load paths
2024-07-23 15:09:10 DEBUG    manager                       Found config: /home/code/.config/flexget/config.yml
2024-07-23 15:09:10 DEBUG    manager                       Config file /home/code/.config/flexget/config.yml selected
2024-07-23 15:09:10 DEBUG    manager                       sys.defaultencoding: utf-8
2024-07-23 15:09:10 DEBUG    manager                       sys.getfilesystemencoding: utf-8
2024-07-23 15:09:10 DEBUG    manager                       flexget detected io encoding: utf-8
2024-07-23 15:09:10 DEBUG    manager                       os.path.supports_unicode_filenames: False
2024-07-23 15:09:10 DEBUG    plugin                        Trying to load plugins from: ['/home/code/.config/flexget/plugins', '/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/plugins']
2024-07-23 15:09:10 DEBUG    plugin                        Plugin `memusage` requires plugin `guppy3` to load.
2024-07-23 15:09:11 DEBUG    plugin                        Trying to load components from: ['/home/code/.config/flexget/components', '/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/components']
2024-07-23 15:09:11 DEBUG    plugin                        Plugins took 0.94 seconds to load. 324 plugins in registry.
2024-07-23 15:09:11 VERBOSE  manager                       Creating new database /home/code/.config/flexget/db-config.sqlite - DO NOT INTERRUPT ...
2024-07-23 15:09:11 DEBUG    manager                       Connecting to: sqlite:////home/code/.config/flexget/db-config.sqlite
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin simple_persistence schema version to 4
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin feed schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin log_once schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin api_rottentomatoes schema version to 2
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin make_rss schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin input_cache schema version to 2
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin gazelle_session schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin tail schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin discover schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin api_bluray schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin myepisodes schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin pogcal_acquired schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin upgrade schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin delay schema version to 3
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin digest schema version to 2
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin version_checker schema version to 0
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin remember_rejected schema version to 3
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin failed schema version to 3
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin status schema version to 3
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin api_tvdb schema version to 7
2024-07-23 15:09:17 DEBUG    schema                        Initializing plugin imdb_lookup schema version to 10
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin imdb_list schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin subtitle_list schema version to 1
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin movie_list schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin regexp_list schema version to 1
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin entry_list schema version to 2
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin pending_list schema version to 1
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin tvmaze schema version to 7
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin alpharatio schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin rutracker_auth schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin filelist schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin morethantv schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin variables schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin backlog schema version to 3
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin seen schema version to 4
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin archive schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin api_tmdb schema version to 6
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin telegram_chat_ids schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin trakt_auth schema version to 0
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin api_trakt schema version to 7
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin series schema version to 14
2024-07-23 15:09:18 DEBUG    schema                        Initializing plugin pending_approval schema version to 1
2024-07-23 15:09:18 DEBUG    manager                       config_name: config
2024-07-23 15:09:18 DEBUG    manager                       config_base: /home/code/.config/flexget
2024-07-23 15:09:18 DEBUG    manager                       New config data loaded.
2024-07-23 15:09:18 DEBUG    schema                        entering flexget version 3.11.41 to db
2024-07-23 15:09:18 DEBUG    parsing                       setting default movie parser to internal. (options: {'internal': <flexget.components.parsing.parsers.parser_internal.ParserInternal object at 0x7f0b85d06210>, 'guessit': <flexget.components.parsing.parsers.parser_guessit.ParserGuessit object at 0x7f0b85d06350>})
2024-07-23 15:09:18 DEBUG    parsing                       setting default series parser to internal. (options: {'internal': <flexget.components.parsing.parsers.parser_internal.ParserInternal object at 0x7f0b85d06210>, 'guessit': <flexget.components.parsing.parsers.parser_guessit.ParserGuessit object at 0x7f0b85d06350>})
2024-07-23 15:09:18 DEBUG    cron_env                      Encoding utf-8 stored
2024-07-23 15:09:18 DEBUG    util.simple_persistence                 setting key terminal_encoding value 'utf-8'
2024-07-23 15:09:18 DEBUG    task_queue                    task queue shutdown requested
2024-07-23 15:09:18 INFO     ipc.rpyc                      server started on [127.0.0.1]:32867
2024-07-23 15:09:18 DEBUG    task          fake-task task  executing fake-task task
2024-07-23 15:09:18 DEBUG    status        fake-task task  Adding new task fake-task task
2024-07-23 15:09:18 DEBUG    exec          fake-task task  phase on_start not configured
2024-07-23 15:09:18 VERBOSE  filesystem    fake-task task  Starting to scan folders.
2024-07-23 15:09:18 VERBOSE  filesystem    fake-task task  Scanning folder /home/code/.flexget-fake/inputs. Recursion is set to True.
2024-07-23 15:09:18 DEBUG    filesystem    fake-task task  Scanning /home/code/.flexget-fake/inputs
2024-07-23 15:09:18 DEBUG    filesystem    fake-task task  Checking if /home/code/.flexget-fake/inputs/test qualifies to be added as an entry.
2024-07-23 15:09:18 DEBUG    filesystem    fake-task task  Checking if /home/code/.flexget-fake/inputs/test/two qualifies to be added as an entry.
2024-07-23 15:09:18 DEBUG    filesystem    fake-task task  Checking if /home/code/.flexget-fake/inputs/test/four qualifies to be added as an entry.
2024-07-23 15:09:18 DEBUG    filesystem    fake-task task  Checking if /home/code/.flexget-fake/inputs/test/three qualifies to be added as an entry.
2024-07-23 15:09:18 DEBUG    filesystem    fake-task task  Checking if /home/code/.flexget-fake/inputs/test/one qualifies to be added as an entry.
2024-07-23 15:09:18 DEBUG    exec          fake-task task  phase on_input not configured
2024-07-23 15:09:18 DEBUG    backlog       fake-task task  0 entries purged from backlog
2024-07-23 15:09:18 VERBOSE  details       fake-task task  Produced 5 entries.
2024-07-23 15:09:18 CRITICAL task          fake-task task  BUG: Unhandled error in plugin seen: 'str' object has no attribute 'tzinfo'
Traceback (most recent call last):

  File "/usr/lib/python3.11/threading.py", line 995, in _bootstrap
    self._bootstrap_inner()
    │    └ <function Thread._bootstrap_inner at 0x7f0b8b521440>
    └ <Thread(task_queue, started daemon 139687462217408)>
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
    │    └ <function Thread.run at 0x7f0b8b521120>
    └ <Thread(task_queue, started daemon 139687462217408)>
  File "/usr/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
    │    │        │    │        │    └ {}
    │    │        │    │        └ <Thread(task_queue, started daemon 139687462217408)>
    │    │        │    └ ()
    │    │        └ <Thread(task_queue, started daemon 139687462217408)>
    │    └ <bound method TaskQueue.run of <flexget.task_queue.TaskQueue object at 0x7f0b85b91ed0>>
    └ <Thread(task_queue, started daemon 139687462217408)>
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/task_queue.py", line 46, in run
    self.current_task.execute()
    │    │            └ <function Task.execute at 0x7f0b88c28220>
    │    └ <flexget.task.Task object at 0x7f0b85978990>
    └ <flexget.task_queue.TaskQueue object at 0x7f0b85b91ed0>
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/task.py", line 87, in wrapper
    return func(self, *args, **kw)
           │    │      │       └ {}
           │    │      └ ()
           │    └ <flexget.task.Task object at 0x7f0b85978990>
           └ <function Task.execute at 0x7f0b88c28180>
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/task.py", line 716, in execute
    self._execute()
    │    └ <function Task._execute at 0x7f0b88c280e0>
    └ <flexget.task.Task object at 0x7f0b85978990>
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/task.py", line 685, in _execute
    self.__run_task_phase(phase)
    │                     └ 'filter'
    └ <flexget.task.Task object at 0x7f0b85978990>
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/task.py", line 514, in __run_task_phase
    response = self.__run_plugin(plugin, phase, args)
               │                 │       │      └ (<flexget.task.Task object at 0x7f0b85978990>, {'local': True, 'fields': ['title', 'url', 'content_size', 'modified']})
               │                 │       └ 'filter'
               │                 └ <PluginInfo(name=seen)>
               └ <flexget.task.Task object at 0x7f0b85978990>
> File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/task.py", line 547, in __run_plugin
    result = method(*args, **kwargs)
             │       │       └ {}
             │       └ (<flexget.task.Task object at 0x7f0b85978990>, {'local': True, 'fields': ['title', 'url', 'content_size', 'modified']})
             └ <Event(name=plugin.seen.filter,func=on_task_filter,priority=255)>
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/event.py", line 21, in __call__
    return self.func(*args, **kwargs)
           │    │     │       └ {}
           │    │     └ (<flexget.task.Task object at 0x7f0b85978990>, {'local': True, 'fields': ['title', 'url', 'content_size', 'modified']})
           │    └ <bound method FilterSeen.on_task_filter of <flexget.components.seen.seen.FilterSeen object at 0x7f0b85d05790>>
           └ <Event(name=plugin.seen.filter,func=on_task_filter,priority=255)>
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/components/seen/seen.py", line 77, in on_task_filter
    if entry[field] not in values and entry[field]:
       │     │             │          │     └ 'modified'
       │     │             │          └ <Entry(title=test,state=undecided)>
       │     │             └ ['test', 'file:///home/code/.flexget-fake/inputs/test']
       │     └ 'modified'
       └ <Entry(title=test,state=undecided)>
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/utils/template.py", line 106, in __eq__
    self, other = self._same_tz(self, other)
    │             │    │        │     └ 'test'
    │             │    │        └ CoercingDateTime(2024, 7, 23, 15, 7, 8, 447270, tzinfo=Timezone('Etc/UTC'))
    │             │    └ <staticmethod(<function CoercingDateTime._same_tz at 0x7f0b88ec5b20>)>
    │             └ CoercingDateTime(2024, 7, 23, 15, 7, 8, 447270, tzinfo=Timezone('Etc/UTC'))
    └ CoercingDateTime(2024, 7, 23, 15, 7, 8, 447270, tzinfo=Timezone('Etc/UTC'))
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/utils/template.py", line 83, in _same_tz
    if first.tzinfo and not second.tzinfo:
       │     │              └ 'test'
       │     └ <attribute 'tzinfo' of 'datetime.datetime' objects>
       └ CoercingDateTime(2024, 7, 23, 15, 7, 8, 447270, tzinfo=Timezone('Etc/UTC'))

AttributeError: 'str' object has no attribute 'tzinfo'
Traceback (most recent call last):
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/task.py", line 547, in __run_plugin
    result = method(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/event.py", line 21, in __call__
    return self.func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/components/seen/seen.py", line 77, in on_task_filter
    if entry[field] not in values and entry[field]:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/utils/template.py", line 106, in __eq__
    self, other = self._same_tz(self, other)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/code/.local/lib/flexget/lib/python3.11/site-packages/flexget/utils/template.py", line 83, in _same_tz
    if first.tzinfo and not second.tzinfo:
                            ^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'tzinfo'

Additional information:

  • FlexGet version: 3.11.41
  • Python version: 3.11.2, 3.11.9
  • Installation method: pip
  • Using daemon (yes/no): no
  • OS and version: Alpine 3.19 / Debian 12
  • Link to crash log: see above

The error appeared as soon as I upgraded to flexget 3.11, on the latest version of 3.10 I do not have the issue.

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