AttributeError: 'NoneType' object has no attribute 'date' #7

Closed
opened 2024-06-23 17:10:43 +02:00 by pilou · 0 comments

stats.biggest.date peut être utilisé alors que stats.biggest est None:

Jun 23 16:00:45 bots python3[1938655]: Traceback (most recent call last):
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/src/hebdobot.py", line 91, in 
Jun 23 16:00:45 bots python3[1938655]:     HebdoBot(settings).start()
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/bot.py", line 348, in start
Jun 23 16:00:45 bots python3[1938655]:     super().start()
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 1272, in start
Jun 23 16:00:45 bots python3[1938655]:     self.reactor.process_forever()
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 916, in process_forever
Jun 23 16:00:45 bots python3[1938655]:     consume(repeatfunc(one))
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/more_itertools/recipes.py", line 184, in consume
Jun 23 16:00:45 bots python3[1938655]:     deque(iterator, maxlen=0)
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 897, in process_once
Jun 23 16:00:45 bots python3[1938655]:     self.process_data(in_)
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 862, in process_data
Jun 23 16:00:45 bots python3[1938655]:     conn.process_data()
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 338, in process_data
Jun 23 16:00:45 bots python3[1938655]:     self._process_line(line)
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 369, in _process_line
Jun 23 16:00:45 bots python3[1938655]:     handler(arguments, command, source, tags)
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 413, in _handle_message
Jun 23 16:00:45 bots python3[1938655]:     self._handle_event(event)
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 446, in _handle_event
Jun 23 16:00:45 bots python3[1938655]:     self.reactor._handle_event(self, event)
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 992, in _handle_event
Jun 23 16:00:45 bots python3[1938655]:     result = handler.callback(connection, event)
Jun 23 16:00:45 bots python3[1938655]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 1229, in _dispatcher
Jun 23 16:00:45 bots python3[1938655]:     method(connection, event)
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/src/hebdobot.py", line 73, in on_pubmsg
Jun 23 16:00:45 bots python3[1938655]:     if hook.process(self, channel, sender, message):
Jun 23 16:00:45 bots python3[1938655]:        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/src/hooks/finish_review.py", line 49, in process
Jun 23 16:00:45 bots python3[1938655]:     report = bot.review.report(stats, bot.settings.USER_ALIASES)
Jun 23 16:00:45 bots python3[1938655]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 23 16:00:45 bots python3[1938655]:   File "/srv/hebdobot-py/src/review/review.py", line 221, in report
Jun 23 16:00:45 bots python3[1938655]:     f"{stats.biggest.date.strftime(formatter)}.\n"
Jun 23 16:00:45 bots python3[1938655]:        ^^^^^^^^^^^^^^^^^^
Jun 23 16:00:45 bots python3[1938655]: AttributeError: 'NoneType' object has no attribute 'date'
Jun 23 16:00:45 bots systemd[1]: hebdobot-v3.service: Main process exited, code=exited, status=1/FAILURE
Jun 23 16:00:45 bots systemd[1]: hebdobot-v3.service: Failed with result 'exit-code'.
`stats.biggest.date` peut être utilisé alors que `stats.biggest` est `None`: <pre> Jun 23 16:00:45 bots python3[1938655]: Traceback (most recent call last): Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/src/hebdobot.py", line 91, in <module> Jun 23 16:00:45 bots python3[1938655]: HebdoBot(settings).start() Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/bot.py", line 348, in start Jun 23 16:00:45 bots python3[1938655]: super().start() Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 1272, in start Jun 23 16:00:45 bots python3[1938655]: self.reactor.process_forever() Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 916, in process_forever Jun 23 16:00:45 bots python3[1938655]: consume(repeatfunc(one)) Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/more_itertools/recipes.py", line 184, in consume Jun 23 16:00:45 bots python3[1938655]: deque(iterator, maxlen=0) Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 897, in process_once Jun 23 16:00:45 bots python3[1938655]: self.process_data(in_) Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 862, in process_data Jun 23 16:00:45 bots python3[1938655]: conn.process_data() Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 338, in process_data Jun 23 16:00:45 bots python3[1938655]: self._process_line(line) Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 369, in _process_line Jun 23 16:00:45 bots python3[1938655]: handler(arguments, command, source, tags) Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 413, in _handle_message Jun 23 16:00:45 bots python3[1938655]: self._handle_event(event) Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 446, in _handle_event Jun 23 16:00:45 bots python3[1938655]: self.reactor._handle_event(self, event) Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 992, in _handle_event Jun 23 16:00:45 bots python3[1938655]: result = handler.callback(connection, event) Jun 23 16:00:45 bots python3[1938655]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/venv/lib/python3.11/site-packages/irc/client.py", line 1229, in _dispatcher Jun 23 16:00:45 bots python3[1938655]: method(connection, event) Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/src/hebdobot.py", line 73, in on_pubmsg Jun 23 16:00:45 bots python3[1938655]: if hook.process(self, channel, sender, message): Jun 23 16:00:45 bots python3[1938655]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/src/hooks/finish_review.py", line 49, in process Jun 23 16:00:45 bots python3[1938655]: report = bot.review.report(stats, bot.settings.USER_ALIASES) Jun 23 16:00:45 bots python3[1938655]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jun 23 16:00:45 bots python3[1938655]: File "/srv/hebdobot-py/src/review/review.py", line 221, in report Jun 23 16:00:45 bots python3[1938655]: f"{stats.biggest.date.strftime(formatter)}.\n" Jun 23 16:00:45 bots python3[1938655]: ^^^^^^^^^^^^^^^^^^ Jun 23 16:00:45 bots python3[1938655]: AttributeError: 'NoneType' object has no attribute 'date' Jun 23 16:00:45 bots systemd[1]: hebdobot-v3.service: Main process exited, code=exited, status=1/FAILURE Jun 23 16:00:45 bots systemd[1]: hebdobot-v3.service: Failed with result 'exit-code'. </pre>
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mindiell/hebdobot#7
No description provided.