matrix-nio icon indicating copy to clipboard operation
matrix-nio copied to clipboard

Error while importing store:

Open devilankur18 opened this issue 5 years ago • 4 comments

Its breaking while importing any of the stores.

python: 3.7 os: macosx 10.14.6 nio version: 0.7.1

Error

cannot import name 'Accounts' from 'nio.store'

from nio.store.database import (SqliteStore)

  store = SqliteStore(
        user_id=self.userID,
        device_id=self.deviceId,
        store_path=self.storePath,
        database_name="robot"
    )
    config = ClientConfig(
        store=store,
        store_name="robot",
        store_sync_tokens=True
    )

    self.client = AsyncClient(
        matrix['homeserver'],
        self.userID,
        device_id=self.deviceId,
        config=config,
        store_path=self.storePath,
    )

devilankur18 avatar Feb 03 '20 18:02 devilankur18

This seems to do the magic, but it stuck at other error pip install olm

>>> from nio.store.database import (SqliteStore)
usage: [-h] [-i] [-d] [-r] [-s SETTINGS] [-l LOG_LEVEL] src
: error: the following arguments are required: src

devilankur18 avatar Feb 03 '20 18:02 devilankur18

You don't need to instantiate a store before passing it to the client, just pass the class.

Also you might want to change folders, it seems that your python interpreter wants to import the never finished nio CLI. I should delete that thing.

poljar avatar Feb 03 '20 20:02 poljar

I have the same problem with matrix_nio-0.15.2 Just that import line hijacks my command line arguments. And looks like the problem is OLM:

Python 3.7.7 (default, Jun 16 2020, 01:13:14) 
[Clang 8.0.1 (tags/RELEASE_801/final 366581)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> from nio.store.database import (SqliteStore)
usage: [-h] [-i] [-d] [-r] [-s SETTINGS] [-l LOG_LEVEL] src
: error: the following arguments are required: src

if I run it in a python script with -h option I am getting:

Olm static site generator

positional arguments:
  src                   Path to site folder

optional arguments:
  -h, --help            show this help message and exit
  -i, --init            Initiliase a project at src
  -d, --disable-caching
                        Disable caching
  -r, --disable-caching-and-rewrite
                        Disable caching but still rewrite cache files
  -s SETTINGS, --settings SETTINGS
                        Path to settings.py file
  -l LOG_LEVEL, --log-level LOG_LEVEL
                        Set log level

Artiom-M avatar Nov 25 '20 00:11 Artiom-M

You installed olm instead of python-olm.

poljar avatar Nov 25 '20 20:11 poljar