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

ImportError in nebula_carina.ngql.schema.space of create_space (most likely due to a circular import) #13

Open
toshihiro1995 opened this issue May 2, 2023 · 1 comment

Comments

@toshihiro1995
Copy link
Contributor

toshihiro1995 commented May 2, 2023

Hi.

The sample code in the README didn't work.

from nebula_carina.ngql.schema.space import create_space, show_spaces, VidTypeEnum

main_space_name = "main"

if main_space_name not in show_spaces():
    create_space(main_space_name, (VidTypeEnum.FIXED_STRING, 20))

It's because a circular import.
It is imported in: https://github.com/nebula-contrib/nebula-carina/blob/main/nebula_carina/ngql/connection/connection.py#L107, which is also used in nebula_carina.ngql.schema.space.

Here is error messages:

Python 3.10.5 (main, May  1 2023, 20:40:12) [GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from nebula_carina.ngql.schema.space import create_space
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "hoge/.venv/lib/python3.10/site-packages/nebula_carina/ngql/schema/space.py", line 1, in <module>
    from nebula_carina.ngql.connection.connection import run_ngql, LocalSession
  File "hoge/nebula-hoge/.venv/lib/python3.10/site-packages/nebula_carina/ngql/connection/connection.py", line 107, in <module>
    from nebula_carina.ngql.schema.space import create_space, show_spaces  # noqa
ImportError: cannot import name 'create_space' from partially initialized module 'nebula_carina.ngql.schema.space' (most likely due to a circular import) (hoge/nebula-hoge/.venv/lib/python3.10/site-packages/nebula_carina/ngql/schema/space.py)
@SwordElucidator
Copy link
Collaborator

Thank you for reporting. Would be nice if you can submit a PR for this issue, or I'd like to fix it in the next few days.

toshihiro1995 added a commit to toshihiro1995/nebula-carina that referenced this issue May 3, 2023
wey-gu added a commit that referenced this issue Oct 31, 2023
Fix circular import in connection.py ( #13 )
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

No branches or pull requests

2 participants