Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to run the code below on a Windows Server instance which doesnt allow me to install Python. I've created an exe using pyinstaller. The code runs but instead of staying in the infinite loop the terminal closes and stops running after the code has been executed once.

Can anyone shed some light please?

    import shutil
    import time
    import datetime

    backup_time = int(input('Enter the backup time interval in minutes: ')) * 60

    while True:
        shutil.copytree("src", "dstn" + datetime.datetime.now().strftime("%d-%m-%Y %H-%M-%S"))
        print ('I have made a backup of the rotas ' + datetime.datetime.now().strftime("%d-%m-%Y %H:%M:%S"))
        time.sleep(backup_time)
question from:https://stackoverflow.com/questions/66050043/infinite-loop-not-infinite-pyinstaller-executable

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
141 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...