'"TypeError: writer.writerow() takes exactly one argument (3 given)"

Every time the game switches to "gameover-mode" a line should be added to the scoreboard.csv file. I wrote a funtion to do this, but I keep getting this error message:

Traceback (most recent call last):
  File "C:\Users\Timo\PycharmProjects\2DFlugzeugspiel\main.py", line 208, in <module>
    scoreboard_write()
  File "C:\Users\Timo\PycharmProjects\2DFlugzeugspiel\main.py", line 93, in scoreboard_write
    writer.writerow(current_player, score, date)
TypeError: writer.writerow() takes exactly one argument (3 given)

Otherwise the program works perfectly fine and there are no errors.

def scoreboard_write():
    from datetime import date # Import module for date

    today = date.today()
    date = today.strftime("%d/%m/%Y")

    with open ("scoreboard.csv", "a", newline="") as scoreboard: # Open scoreboard.csv
        writer = csv.writer(scoreboard)
        writer.writerow(current_player, score, date)
...
# Gameover screen
            while running == 3:
                scoreboard_write()
                gameover = False

The variable current_player is a string, the score is an integer.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source