davidlatwe / montydb

Monty, Mongo tinified. MongoDB implemented in Python !

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MontyClient instanciation fails

ramnes opened this issue · comments

Hey @davidlatwe, thanks for the great library!

There may be something wrong with MontyClient() called without any argument, as it fails when a .monty.storage file already exists.

Take such a file:

import montydb

montydb.MontyClient()

Run it twice and you should get this:

$ python issue.py
$ # no error yet
$ python issue.py
Traceback (most recent call last):
  File "issue.py", line 3, in <module>
    montydb.MontyClient()
  File ".venv/lib/python3.9/site-packages/montydb/client.py", line 50, in __init__
    self.__options = ClientOptions(options, wconcern)
  File ".venv/lib/python3.9/site-packages/montydb/base.py", line 205, in __init__
    self.__codec_options = bson.parse_codec_options(options)
TypeError: 'NoneType' object is not callable

If this is "normal", maybe an explicit error would make sense here. :)

For the context, Mongo-Thingy is an ODM that supports Monty as a backend. One of our users tried to use Monty and got stuck with this issue: Refty/mongo-thingy#48

Hi @ramnes , thanks for the kind words :)

Yes, that indeed is a bug. I've added a test case for it and should be fixed now.
Could you have a test with the current master branch and confirm the issue has been resolved?

Thanks :)

yep, that works :)

Thanks! Will make a release shortly, before the end of this week. 🍻