omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. drscheme
    3. Topics

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 8
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by drscheme

    • drscheme

      Correctly exiting an app
      Pythonista • • drscheme

      4
      0
      Votes
      4
      Posts
      3129
      Views

      ccc

      The most readable way to end an infinite loop is to break out of the loop when some condition is met.

      # top_of_the_minute: loop forever until seconds is zero import datetime print('Waiting {}...'.format(datetime.datetime.now().second)) while True: # break out of the infinite loop when seconds is zero if not datetime.datetime.now().second: break # or exit('Done.') or quit('Done.') or raise SystemExit('Done.') or sys.exit('Done.') print('Done.')

      I often use sys.exit() as mentioned by @Phukett2 above but raise SystemExit or exit([text or number]) or quit([text or number]) work just as well and do not require an import.

      See http://stackoverflow.com/questions/19747371/python-exit-commands-why-so-many-and-when-should-each-be-used

      break is best but raise SystemExit('Done.') works well too.

    • drscheme

      Import Scripts written on Mac/PC to Pythonista?
      Pythonista • • drscheme

      34
      0
      Votes
      34
      Posts
      53471
      Views

      Phuket2

      @AlinMechenici , sorry I can open this in Twitter as I stopped using it. But I think the below link will work for you
      https://twitter.com/olemoritz/status/700770989114667009?lang=en

    • drscheme

      Speech to Text
      Pythonista • • drscheme

      6
      0
      Votes
      6
      Posts
      3990
      Views

      omz

      You're right, this isn't possible right now (that might change though).