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: cannot import name forecast #21

Open
ParityError opened this issue Dec 18, 2019 · 1 comment
Open

ImportError: cannot import name forecast #21

ParityError opened this issue Dec 18, 2019 · 1 comment
Assignees

Comments

@ParityError
Copy link

ParityError commented Dec 18, 2019

I installed via:

$ sudo pip uninstall darksky && pip install darkskylib --upgrade --no-cache- --force-reinstall

and get the following error:

$ python darksky_example.py 
Traceback (most recent call last):
  File "darksky_example.py", line 1, in <module>
    from darksky import forecast
  File "darksky_example.py", line 4, in <module>
    from darksky import forecast
ImportError: cannot import name 'forecast'

Using this exact code:

from darksky import forecast
from datetime import date, timedelta

BOSTON = 42.3601, 71.0589

weekday = date.today()
with forecast('API_KEY', *BOSTON) as boston:
    print(boston.daily.summary)
    for day in boston.daily:
        day = dict(day = date.strftime(weekday, '%a'),
                   sum = day.summary,
                   tempMin = day.temperatureMin,
                   tempMax = day.temperatureMax
                   )
        print('{day}: {sum} Temp range: {tempMin} - {tempMax}'.format(**day))
        weekday += timedelta(days=1)

Info: Python 3.6.9

@lukaskubis
Copy link
Owner

I'd recommend to try this in a clean docker container like so:

docker run -it python:3.7-slim sh

once inside, try to replicate, if that won't help, we indeed have a problem here.

@lukaskubis lukaskubis self-assigned this Dec 26, 2019
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