omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. towerofnix

    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 0
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    towerofnix

    @towerofnix

    0
    Reputation
    485
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    towerofnix Unfollow Follow

    Latest posts made by towerofnix

    • RE: atexit module not working

      I'm on Pythonista 3 and atexit.register on its own doesn't quite work - running sys.exit will call the registered atexit function but forcibly terminating the program (via the stop button) doesn't do that.

      Using a try..finally like this, worked, though:

      @atexit.register
      def _exitcb():
        print('Exit')
      
      try:
        # Do stuff
      finally:
        exit()
      

      I'm not sure if that's how it would normally work on a computer running Python but that's just a tiny tidbit of hopefully helpful information for anyone coming across this issue.

      posted in Pythonista
      towerofnix
      towerofnix