'Struggling with: "AttributeError: 'builtin_function_or_method' object has no attribute 'fieldnames'"

I'm struggling to break the following error down: "AttributeError: 'builtin_function_or_method' object has no attribute 'fieldnames'"

I'm using the following code, which DOES work on Windows, unlike Linux... which is an issue, because I have to get this working on an AWS server enrolled with Linux.

import csv
from csv import reader

with open('/home/maurits/PolisCheck/check/PolisLists/PolisCheck.csv', newline='') as csvfile:
    PolisCheck = csv.DictReader(csvfile)
    for row in PolisCheck:
        ([col + '=' + row[col] for col in reader.fieldnames])

Thanks in advance!



Sources

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

Source: Stack Overflow

Solution Source