I have the following code, which is supposed to ask the user 2 file names. I get an error with the input() in the second function but not in the first, I don't understand... Here is the error :
output = getOutputFile() File "splitRAW.py", line 22, in getOutputFile fileName = input("\t=> ") TypeError: 'str' object is not callable
# Loops until an existing file has been found def getInputFile(): print("Which file do you want to split ?") fileName = input("\t=> ") while 1: try: file = open(fileName, "r") print("Existing file, let's continue !") return(fileName) except IOError: print("No such existing file...") print("Which file do you want to split ?") fileName = input("\t=> ") # Gets an output file from user def getOutputFile(): print("What name for the output file ?") fileName = input("\t=> ") And here is my main() :
if __name__ == "__main__": input = getInputFile() output = getOutputFile()
input = something_here. Depending on your IDE, it may have have been in a different file or within the console