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 #14

Open
djdejawu opened this issue Jun 13, 2023 · 2 comments
Open

ImportError #14

djdejawu opened this issue Jun 13, 2023 · 2 comments

Comments

@djdejawu
Copy link

ImportError
cannot import name 'Netdata' from partially initialized module 'netdata' (most likely due to a circular import)

when I try to run example.py

`

pip show netdata

Name: netdata
Version: 1.1.0
Summary: Python API for interacting with Netdata
Home-page: https://github.com/home-assistant-ecosystem/python-netdata
Author: Fabian Affolter
Author-email: mail@fabian-affolter.ch
License: MIT
Location: /usr/local/lib/python3.9/site-packages
Requires: httpx, yarl
Required-by:

python3 --version

Python 3.9.13
`

@fabaff
Copy link
Member

fabaff commented Jun 15, 2023

Seems to work in a fresh venv.

[fab@11:~/import-netdata]$ source bin/activate
(import-netdata) 
[fab@11:~/import-netdata]$ pip install netdata
Collecting netdata
[...]
(import-netdata) 
[fab@11:~/import-netdata]$ python
Python 3.10.11 (main, Apr  4 2023, 22:10:32) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import netdata
>>> netdata.Netdata('localhost')
<netdata.Netdata object at 0x7f84c015ba00>

@djdejawu
Copy link
Author

python .\example.py
Traceback (most recent call last):
  File "C:\git\example.py", line 33, in <module>
    asyncio.run(main())
  File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\dejawu\git\engineering\test_tools\netdata.py", line 10, in main
    client = netdata.Netdata("testhost.api.local")
             ^^^^^^^^^^^^^^^
AttributeError: module 'netdata' has no attribute 'Netdata'. Did you mean: 'netdata'?

i've change import netdata but still got errors with exampley.py

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