Python3 で ReJSON をセットアップしようとしています。Windows (WSL) で Ubuntu 16.04 を実行しており、Redis と ReJSON が動作しています。
https://github.com/RedisLabs/rejson-pyドキュメントの python を単純化して、問題を切り分けました。
from rejson import Client, Path
rj = Client(host='localhost', port=6379)
obj = {
'answer': 42,
'arr': [None, True, 3.14],
'truth': {
'coord': 'out there'
}
}
rj.jsonset('obj', Path.rootPath(), obj)
temp = rj.jsonget('obj', Path('.truth.coord'))
最終行のエラー:
TypeError: cannot use a string pattern on a bytes-like object
redis-cli で見られるように、obj が書かれていることを私は知っています:
127.0.0.1:6379> JSON.GET obj
"{\"answer\":42,\"arr\":[null,true,3.1400000000000001],\"truth\":{\"coord\":\"out there\"}}"
どんな助けでも感謝します。