Player Position Error
Closed this issue · 3 comments
Coop197823 commented
I wrote some code last season that was working great. however when I go to run it this season I am getting an error. The code is supposed to pull a few player stats based on which position they play. Here is my code:
week = 1
games = nflgame.games(2017, week)
play = nflgame.combine_plays(games)
path = "C:\\Users\\ccooper\\Documents\\nfl\\Current\\WRDepth\\Incomplete\\Week" + str(week)+".csv"
w = csv.writer(open(path, 'wb'))
w.writerow(["Name", "Team", "Position", "Yds"])
for play in play.filter(passing_incmp__gt=0):
for player in play.players:
if player.player.position in ['WR', 'TE', 'RB']:
row = [player, player.player.team, player.player.position, play.passing_incmp_air_yds]
w.writerow(row)
and my error is:
Runtime error
Traceback (most recent call last):
File "<string>", line 11, in <module>
AttributeError: 'NoneType' object has no attribute 'position'
Any help with this would be much appreciated!!!
Coop197823 commented
so I have noticed when I run the update_players.pyc utility it does not replace the existing players.json...
The update schedule utility does replace the schedule.json
Also in the players.json located on the gitHub pull, it is also missing the team and position field.
Coop197823 commented
followed advice from Jay Deluca at bottom of the page and fixed the error - #316
Coop197823 commented
Thanks yeah that did the trick. I posted in the thread the fix. It seems some older data was causing the script to not update properly
…Sent from my iPhone
On Sep 12, 2017, at 12:48 PM, Salman ***@***.***> wrote:
Have you tried updating the player database using the
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.