@barakuda1

Непонятная ошибка. Как решить проблему с вылетом бота на python?

Как решить?

Получаю следующее:

Traceback (most recent call last):
  File "main.py", line 1277, in telegram_polling
    bot.polling(none_stop=True, timeout=60)  # constantly get messages from Telegram
  File "/usr/local/lib/python3.6/site-packages/telebot/__init__.py", line 622, in polling
    logger_level=logger_level, allowed_updates=allowed_updates)
  File "/usr/local/lib/python3.6/site-packages/telebot/__init__.py", line 695, in __threaded_polling
    raise e
  File "/usr/local/lib/python3.6/site-packages/telebot/__init__.py", line 651, in __threaded_polling
    self.worker_pool.raise_exceptions()
  File "/usr/local/lib/python3.6/site-packages/telebot/util.py", line 147, in raise_exceptions
    raise self.exception_info
  File "/usr/local/lib/python3.6/site-packages/telebot/util.py", line 93, in run
    task(*args, **kwargs)
  File "main.py", line 1071, in handler_call
    curer.insert_one(post)
  File "/usr/local/lib64/python3.6/site-packages/pymongo/collection.py", line 613, in insert_one
    comment=comment,
  File "/usr/local/lib64/python3.6/site-packages/pymongo/collection.py", line 547, in _insert_one
    self.__database.client._retryable_write(acknowledged, _insert_command, session)
  File "/usr/local/lib64/python3.6/site-packages/pymongo/mongo_client.py", line 1399, in _retryable_write
    return self._retry_with_session(retryable, func, s, None)
  File "/usr/local/lib64/python3.6/site-packages/pymongo/mongo_client.py", line 1286, in _retry_with_session
    return self._retry_internal(retryable, func, session, bulk)
  File "/usr/local/lib64/python3.6/site-packages/pymongo/mongo_client.py", line 1320, in _retry_internal
    return func(session, sock_info, retryable)
  File "/usr/local/lib64/python3.6/site-packages/pymongo/collection.py", line 542, in _insert_command
    retryable_write=retryable_write,
  File "/usr/local/lib64/python3.6/site-packages/pymongo/pool.py", line 770, in command
    self._raise_connection_failure(error)
  File "/usr/local/lib64/python3.6/site-packages/pymongo/pool.py", line 764, in command
    exhaust_allowed=exhaust_allowed,
  File "/usr/local/lib64/python3.6/site-packages/pymongo/network.py", line 122, in command
    flags, spec, dbname, read_preference, codec_options, ctx=compression_ctx
  File "/usr/local/lib64/python3.6/site-packages/pymongo/message.py", line 673, in _op_msg
    return _op_msg_uncompressed(flags, command, identifier, docs, opts)
  File "/usr/local/lib64/python3.6/site-packages/bson/binary.py", line 268, in from_uuid
    "cannot encode native uuid.UUID with "
ValueError: cannot encode native uuid.UUID with UuidRepresentation.UNSPECIFIED. UUIDs can be manually converted to bson.Binary instances using bson.Binary.from_uuid() or a different UuidRepresentation can be configured. See the documentation for UuidRepresentation for more information.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 1288, in <module>
    start_bot()
  File "main.py", line 1285, in start_bot
    telegram_polling()
  File "main.py", line 1280, in telegram_polling
    f'\n---------------------------\nВремя ошибки: {datetime.datetime.now()}\n{e}\n-------------------------\n')
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'
  • Вопрос задан
  • 228 просмотров
Пригласить эксперта
Ответы на вопрос 2
@Antoninich
if хобби == работа then свободное время == сон
Если datetime импортируется как from datetime import datetime, то нужно поменять на import datetime
Ответ написан
@b_a_y
Python, Selenium
Для того, что бы мы тебе что то подсказали, покажи весь год, а логи можешь показать к примеру pastie.org. Ибо очень не удобно читать такие портянки
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы