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

Library Partial Import Error #70

Open
advisely opened this issue Jul 8, 2021 · 1 comment
Open

Library Partial Import Error #70

advisely opened this issue Jul 8, 2021 · 1 comment

Comments

@advisely
Copy link

advisely commented Jul 8, 2021

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
@jszafran
Copy link

@BlueSkyTrading Quite possible that you have already figured it out on your own but I'll give it a try anyway - you should change name of your file newsapi.py to something else to avoid modules names conflict.

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