I'm writing a backup script. It gathers all files with predefined extentions, splits them up in categories and copies them to new folders (if the user wants it). Part of my code is asking the user if he/she wants to copy these items. I've written a function for it.
- Code: Select all
def AskPrint(type, action):
inp=input(action+" "+type+"?(y/n)")
while not (inp.lower() == 'y' or inp.lower() == 'n') :
AskPrint(type, action)
if inp=='y' :
return True
else :
return False
As long as I start the script within IDLE(python GUI) everything works fine. However, if I run this script from the command line(python <scriptnamehere>), I go into an endless loop. Now I'm wondering why. Is there a difference between input in IdLE and input from cmd?
if you're interested in the complete script, let me know, I'll post it.