zero-sum-seattle / python-mlb-statsapi

Python Wrapper for the MLB's Official Stats API
MIT License
44 stars 11 forks source link

TypeError: dataclass() got an unexpected keyword argument 'kw_only' #187

Closed VermiThrax423 closed 1 year ago

VermiThrax423 commented 1 year ago

Just trying to start off simple to see how things work

from mlbstatsapi import Mlb

all_teams = Mlb.get_teams()

print(all_teams)

in running the above I get the error below:

Traceback (most recent call last):
  File "C:\Users\Matthew\PycharmProjects\MLB_data\main.py", line 2, in <module>
    from mlbstatsapi import Mlb
  File "C:\Users\Matthew\PycharmProjects\MLB_data\venv\lib\site-packages\mlbstatsapi\__init__.py", line 1, in <module>
    from .mlb_api import Mlb
  File "C:\Users\Matthew\PycharmProjects\MLB_data\venv\lib\site-packages\mlbstatsapi\mlb_api.py", line 6, in <module>
    from mlbstatsapi.models.people import Person, Player, Coach
  File "C:\Users\Matthew\PycharmProjects\MLB_data\venv\lib\site-packages\mlbstatsapi\models\people\__init__.py", line 2, in <module>
    from .people import Player, Coach, Person, Batter, Pitcher, DraftPick
  File "C:\Users\Matthew\PycharmProjects\MLB_data\venv\lib\site-packages\mlbstatsapi\models\people\people.py", line 163, in <module>
    @dataclass(kw_only=True)
TypeError: dataclass() got an unexpected keyword argument 'kw_only'
KCNilssen commented 1 year ago

@VermiThrax423 which Python version are you using?

kw_only is introduced with Python 3. If you are using Python 2, that could be one reason for the output.

Mattsface commented 1 year ago

Python 3.10+ will resolve this issue.

VermiThrax423 commented 1 year ago

I was still using 3.9, I installed 3.10 and 3.11 and was able to get it to work with 3.10. I appreciate the time, still kind of new to all of this and trying to use something else I love to help me grow my skill base!