uberfastman / yfpy

Python API wrapper for the Yahoo Fantasy Sports public API (supports NFL, NHL, MLB, and NBA).
https://pypi.org/project/yfpy/
GNU General Public License v3.0
163 stars 44 forks source link

Error Importing YFPY packages: 'type' object is not subscriptable #29

Closed gman1594 closed 1 year ago

gman1594 commented 1 year ago

After upgrading to yfpy 8.0.7 from a much older version, I can no longer import the packages.

It looks like in utils.py there is some issue with Python recognizing the instance of typing.Dict as a dict object, which throws the error.

I'm fairly new to this so my apologies if this has been brought up before or if this is an issue on my end.

image

gman1594 commented 1 year ago

Update: This issue was caused by me running Python 3.7. It looks like this leads to issues with the 'typing' type hint module. Running on Python 3.9 solved the issue.

uberfastman commented 1 year ago

Hmm, that's puzzling. It should work for Python 3.7, but to be fair I haven't extensively tested all Python versions. I did notice you're using Anaconda, which uses its own distribution of Python that isn't always identical to the official distributions, so maybe that could have been affecting it, but that's just speculation.

Regardless, I'm glad you got it working! Let me know if anything else comes up.

AsteroidOrangeJuice commented 1 year ago

OrderedDict is not subscript-able until python 3.9.

https://peps.python.org/pep-0585/

I hit this issue on python 3.8.x as well.

uberfastman commented 1 year ago

@gman1594 @AsteroidOrangeJuice I've updated YFPY to v8.0.8 to fix the backwards compatibility with the type hints.