Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Client ImportError cannot import name NoneType #4

Closed
amaster507 opened this issue Sep 15, 2022 · 0 comments · Fixed by #5
Closed

Python Client ImportError cannot import name NoneType #4

amaster507 opened this issue Sep 15, 2022 · 0 comments · Fixed by #5

Comments

@amaster507
Copy link
Contributor

$ 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.

amaster507 added a commit to amaster507/AnnaDB that referenced this issue Sep 15, 2022
roman-right added a commit that referenced this issue Sep 15, 2022
fix #4 by declaring NoneType instead of importing it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant