Giter Site home page Giter Site logo

src/boards/team_summary.py line 98: "stats.gamesPlayed" - "stats" is sometimes not stats, but a boolean set to False about nhl-led-scoreboard HOT 4 CLOSED

riffnshred avatar riffnshred commented on June 3, 2024
src/boards/team_summary.py line 98: "stats.gamesPlayed" - "stats" is sometimes not stats, but a boolean set to False

from nhl-led-scoreboard.

Comments (4)

ka9cql avatar ka9cql commented on June 3, 2024

It looks like "stats" was set to a boolean on line 47 of src/nhl_api/info.py because the NHL API didn't return any stats for that team. (It sets "stats = False")

Possible fix:

Line 98 of src/boards/team_summary.py probably needs a check whether "stats" is a boolean (as appears to be the case of no stats for that team) or a "stats" dictionary or list, as picked up from the NHL API on line 44 of src/nhl_api/info.py

from nhl-led-scoreboard.

ka9cql avatar ka9cql commented on June 3, 2024

This might be a good fix for line 98 of src/boards/team_summary.py -
if isinstance(stats, bool) == False:
draw.text((0, 7), "GP: {} P: {}".format(stats.gamesPlayed, stats.pts), fill=(255, 255, 255),........(etc)

This fix should also protect other lines (96-101?), or something, to prevent other uses of the "stats" variable when it's not filled in (aka "stats" is a boolean set to False). I just don't know the codebase well enough to formally submit a "complete" fix...

from nhl-led-scoreboard.

riffnshred avatar riffnshred commented on June 3, 2024

Thank you for finding this, I'll look into it and push a fix soon.

from nhl-led-scoreboard.

riffnshred avatar riffnshred commented on June 3, 2024

This was cause by an error in the way I printed the error message. Got fix in V 1.1.2

from nhl-led-scoreboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.