def get_box_score(game_id):
    """Return the box score file of a game with matching id."""
    # get relevant information from game id
    year, month, day, rest = game_id.split('_', 3)
    # file
    filename = "gameday-data/year_%s/month_%s/day_%s/gid_%s/boxscore.xml" % (year, month, day, game_id)
    file = os.path.join(os.path.dirname(__file__), filename)
    # check if file exits
    if os.path.isfile(file):
        data = file
    else:
        # get data if file does not exist
        try:
            data = urlopen((year, month, day, game_id) % "http://gd2.mlb.com/components/game/mlb/year_%s/month_%s/day_%s/gid_%s/boxscore.xml")
        except HTTPError:
            raise ValueError("Could not find a game with that id.")
    return data
dataset/ETHPy150Open zachpanz88/mlbgame/mlbgame/data.py/get_box_score/swapped operands of `%`