omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    While True is True :

    Pythonista
    2
    2
    1081
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • donnieh
      donnieh last edited by

      Is it bad practice to use a forever loop in pythonista? I ask because I used the def download_file function from the omz dropbox file picker script in my own script. It worked great except once my program completed it's start up code and entered the while loop, I had issues with the downloaded file.

      If I downloaded a file using omz's DropBox script in the while loop and then tried to read it using f = open('file_name') outside the while loop, it would not read or see the file. Can I only read the file in the same scope I downloaded it? I could open it inside the while loop, however.

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        The trick is that you have to have a break or sys.exit() or similar somewhere in that loop or your device is going to churn until its batteries run out. Computers are still very literal.

        Oh, and... while True: is sufficient to start an infinite loop.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors