'Getting stuck in a while loop - values updating, but while loop is stuck

I have set up an input for a file name at the top of my script. After it is entered I am checking if it is correct before running the rest of the script.

I have tried an if statement instead of the while loop, however this runs once and then skips to the print line underneath, however the while loop even when the value it is checking for prints as True, still keeps returning to the function.

What am I doing wrong here?

I am complete newb to this, so any help is much appreciated.

Simon

def checkinput():
    maybefileloc = input("Enter Full file location and name : ")
    print("confirming file as : ", maybefileloc)
    fcn = "Y" == input("Is this correct? - Yes or No : ")
    print(maybefileloc, fcn)
    return (maybefileloc, fcn)


maybefile, fileconf = checkinput()


while fileconf == False:
    checkinput()


fileloc = maybefile

print('Running conversion on '+fileloc+', please wait for line length checking')


This is my IDLE output for a test run:

Enter Full file location and name : E:/asdljhjklh

confirming file as : E:/asdljhjklh

Is this correct? - Yes or No : n

E:/asdljhjklh False

Enter Full file location and name : E:/asdjljhjjjjj

confirming file as : E:/asdjljhjjjjj

Is this correct? - Yes or No : Y

E:/asdjljhjjjjj True

Enter Full file location and name :

*** It seems to be getting stuck even through true is being passed??



Sources

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

Source: Stack Overflow

Solution Source