Skip to content

Library Partial Import Error #70

Description

@advisely

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior. For instance:

  1. conda activate venv
  2. pip install newsapi_python
from newsapi import NewsApiClient
# Init
api = NewsApiClient(api_key='xxxxxxxxxxxx')
# /v2/everything
all_articles = api.get_everything(q='mars')
print(all_articles)
  1. (venv) C:\Users\abc\anaconda3\envs\venv\bin>C:/Users/abc/anaconda3/envs/venv/python.exe

Expected behavior
News Data

Screenshots

d:/Projects/advisely/advisely/API/newsapi.py
Traceback (most recent call last):
  File "d:/Projects/newsoftoday/API/newsapi.py", line 3, in <module>
    from newsapi import NewsApiClient
  File "d:\Projects\newsoftoday\API\newsapi.py", line 3, in <module>
    from newsapi import NewsApiClient
ImportError: cannot import name 'NewsApiClient' from partially initialized module 'newsapi' (most likely due to a circular import) (d:\Projects\newsoftoday\API\newsapi.py)

Desktop (please complete the following information):

  • OS: Windows 10
  • Visual Studio Code
  • Version [1.57.1]

Additional context

(venv) C:\Users\abc\anaconda3\envs\venv\bin>pip install newsapi_python   
Collecting newsapi_python
  Using cached newsapi_python-0.2.6-py2.py3-none-any.whl (7.9 kB)
Requirement already satisfied: requests<3.0.0 in c:\users\abc\anaconda3\envs\venv\lib\site-packages (from newsapi_python) (2.25.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\abc\anaconda3\envs\venv\lib\site-packages (from requests<3.0.0->newsapi_python) (1.26.5)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\abc\anaconda3\envs\venv\lib\site-packages (from requests<3.0.0->newsapi_python) (2021.5.30)
Requirement already satisfied: idna<3,>=2.5 in c:\users\abc\anaconda3\envs\venv\lib\site-packages (from requests<3.0.0->newsapi_python) (2.10)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\abc\anaconda3\envs\venv\lib\site-packages (from requests<3.0.0->newsapi_python) (4.0.0)
Installing collected packages: newsapi-python
Successfully installed newsapi-python-0.2.6

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions