Anna-Team / AnnaDB

Developer-first database
Apache License 2.0
56 stars 4 forks source link

Python Client ImportError cannot import name NoneType #4

Closed amaster507 closed 1 year ago

amaster507 commented 1 year ago
$ annadb --uri annadb://playground.annadb.dev:10001
Traceback (most recent call last):
  File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python39\Scripts\annadb.exe\__main__.py", line 4, in <module>
  File "c:\python39\lib\site-packages\annadb\__init__.py", line 18, in <module>
    from annadb.connection import Connection
  File "c:\python39\lib\site-packages\annadb\connection.py", line 6, in <module>
    from annadb.dump import to_str
  File "c:\python39\lib\site-packages\annadb\dump.py", line 1, in <module>
    from types import NoneType
ImportError: cannot import name 'NoneType' from 'types' (c:\python39\lib\types.py)

https://github.com/roman-right/AnnaDB/blob/17e85f13532f864911586d9cf1b1e734d762de4b/drivers/python/annadb/dump.py#L1

I am not much of a python developer, but I think this StackOverflow answer might also help:

https://stackoverflow.com/a/15844751/1707323

There is no longer a NoneType reference in the types modules. You should just check for identity with None directly, i.e. obj is None. An alternative way, if you really need the NoneType, would be to get it using:

NoneType = type(None)

This is actually the exact same way types.NoneType was previously defined, before it was removed on November 28th, 2007.