v0.3.6 throws TypeError: '_GeneratorContextManager' object is not subscriptable
See original GitHub issueHello, v0.3.6 doesn’t seem to work anymore - example code:
from darksky import forecast
key='APIKEY'
boston = forecast(key, 42.3601, -71.0589)
boston['currently']
and then I get this traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '_GeneratorContextManager' object is not subscriptable
Downgraded to v0.3.5 and it worked again.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
'GeneratorContextManager' Object does not support indexing
It is a @contextmanager, which handles the temporary file deletion for you. But one should use it with with : with pfx_to_pem(clientCert ...
Read more >contextlib — Utilities for with-statement contexts ... - Python Docs
An abstract base class for classes that implement object. ... New in version 3.6. ... Otherwise the generator context manager will indicate to...
Read more >Context Managers and Python's with Statement
In this step-by-step tutorial, you'll learn what the Python with statement is and how to use it with existing context managers.
Read more >contextmanager function return value incorrectly marked as ...
from contextlib import contextmanager @contextmanager def mycm(): yield @mycm() # <-- PyCharm flags as 'Generator' object is not callable def ...
Read more >The Curious Case of Python's Context Manager
If no unhandled exception occurs, the code gracefully proceeds to the finally ... from contextlib import contextmanager @contextmanager def ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll revert this nonsense back to what it was during the weekend and update the whole thing. I don’t even remember what was my original intention behind this.
AAA yes I see now, this is a change in functionality, whereby the
forecast
function, instead of returningForecast
object, now acts just as a context manager, yielding theForercast
inside awith
statement.try one of these: (I’m unable to do so at this time):
I’ll keep this issue open until I do something about this. Thanks for letting me know.