''int' object not callable when opening a file in python

I am getting what seems to be an odd error when trying to open a file in python. I am simply trying to open a csv:

with open(filename, 'a') as history:

filename is simply a string pointing the file:

filename = file_path + "\\dashboards\\" + csv_file

it is identified as a string in python, but whenever I get to the open statement, it returns:

TypeError}'int' object not callable

That seems odd as it is just a csv file, with a header. Has anyone run across this before? ``



Solution 1:[1]

It looks like you may have defined open as a variable somewhere else with an int value. This is causing the error message.

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Azarro