Open mcarroll316 opened 2 years ago
I'm not familiar with load_players, looking at it, it may be that it is missing a first_name and last_name fields in your list?
@property def full_name(self) -> str: return '{} {}'.format(self.first_name, self.last_name)
Just a curiosity but if the file load is working what advantage is there to using this method instead?
@mbencho - Re: Missing first_name & last_name was what I was thinking initially as well, but I would think the CSV & json elements would need to be the same, especially considering it's supposed to be based off the Draftkings export.
The reason I'm trying this method is because I'm integrating this into my site and want to avoid having a csv file created from the client, saved to the server, then recalled by python. I'm finding some challenges in getting the csv data OR the json passed from the client to the python script. I tried base64 encoding, but that throws an error when including that as an argument. I've tried several ways to achieve what I attempting to do, with little success.
load_players functions accept list of Player objects, you tried to pass a list of dictionaries and because of it you got this error. You need to build Player objects and pass them.
I'm attempting to use the load_players method (instead of loading from csv), but get the following error:
File "C:\Pypy\lib\site-packages\pydfs_lineup_optimizer\player_pool.py", line 160, in add_player self._players_by_name[player.full_name].append(player) AttributeError: 'dict' object has no attribute 'full_name'
My sample list:
Perhaps it's not a bug, but instead I might be missing or misunderstanding something on the usage. No errors are thrown when I use the load_players_from_csv method.
Would welcome any guidance and assistance. Thank you.