Skip to content

AttributeError: module 'platform' has no attribute 'linux_distribution' #367

@diachkow

Description

@diachkow

Hi, I've tried to use MongoDB as FSMStorage for my bot ...

storage = MongoStorage(
    host='...-yeyrk.mongodb.net/...',
    db_name='...',
    username=settings.MONGO_USERNAME,
    password=settings.MONGO_PASSWORD
)

... and got the next error:

Traceback (most recent call last):
  File "main.py", line 7, in <module>
    from aiogram.contrib.fsm_storage.mongo import MongoStorage
  File "/home/vitaliy/.cache/pypoetry/virtualenvs/evernote-telegram-bot-nn--X-RS-py3.8/lib/python3.8/site-packages/aiogram/contrib/fsm_storage/mongo.py", line 8, in <module>
    import aiomongo
  File "/home/vitaliy/.cache/pypoetry/virtualenvs/evernote-telegram-bot-nn--X-RS-py3.8/lib/python3.8/site-packages/aiomongo/__init__.py", line 4, in <module>
    from .client import AioMongoClient
  File "/home/vitaliy/.cache/pypoetry/virtualenvs/evernote-telegram-bot-nn--X-RS-py3.8/lib/python3.8/site-packages/aiomongo/client.py", line 5, in <module>
    from pymongo.client_options import ClientOptions
  File "/home/vitaliy/.cache/pypoetry/virtualenvs/evernote-telegram-bot-nn--X-RS-py3.8/lib/python3.8/site-packages/pymongo/__init__.py", line 87, in <module>
    from pymongo.mongo_client import MongoClient
  File "/home/vitaliy/.cache/pypoetry/virtualenvs/evernote-telegram-bot-nn--X-RS-py3.8/lib/python3.8/site-packages/pymongo/mongo_client.py", line 52, in <module>
    from pymongo.client_options import ClientOptions
  File "/home/vitaliy/.cache/pypoetry/virtualenvs/evernote-telegram-bot-nn--X-RS-py3.8/lib/python3.8/site-packages/pymongo/client_options.py", line 23, in <module>
    from pymongo.pool import PoolOptions
  File "/home/vitaliy/.cache/pypoetry/virtualenvs/evernote-telegram-bot-nn--X-RS-py3.8/lib/python3.8/site-packages/pymongo/pool.py", line 124, in <module>
    platform.linux_distribution() if part])),
AttributeError: module 'platform' has no attribute 'linux_distribution'

Also, there is actually some documentation lack for aiogram storage's at this moment: https://docs.aiogram.dev/en/latest/dispatcher/fsm.html#storage. I'm not even sure if I'm configuring my MongoStorage the right way (I've found some explenations in MongoStorage's dosctrings, but there was only locally hosted example).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is wrong with the frameworkduplicateThis issue already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions