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.


    Logs from App crashing

    Pythonista
    2
    4
    2660
    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.
    • shaun-h
      shaun-h last edited by shaun-h

      I have been playing around with the objc_utils module and it is really a great module. Although I have been having a few crashes when trying out some specific code now that I'm not asking for help with the code, but does pythonista generate logs when it crashes if so is there something that I could use to read those logs to help with debugging my code, if not it might be a suggestion for a future release that if pythonista crashes it shows on the next start why it happened if that is possible.

      Any suggestions would be great thanks.

      1 Reply Last reply Reply Quote 1
      • shaun-h
        shaun-h last edited by

        Just seeing if anyone has any suggestions for this, I have been trying to play with NSUncaughtExceptionHandler but I am having no luck with even accessing it, it appears to be a data type in Foundation framework so if anyone had pointers on how to access that would be awesome.

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

          this was my attempt... the problem i think is that the main runloop does catch exceptions, so there won't be any unhandled exceptions.

          # coding: utf-8
          from objc_util import *
          
          NSException=ObjCClass('NSException')
          def handleException_(exception):
          	with open('exception.txt','w') as f:
          		f.write('exception'+ObjCInstance(exception).__repr__())
          		f.write(dir(exception))
          		f.write(vars(exception))
          
          ETYPE = ctypes.CFUNCTYPE(None, c_void_p)
          fp = ETYPE(handleException_)
          retain_global(fp)
          
          c.NSSetUncaughtExceptionHandler.argtypes=[c_void_p]
          c.NSSetUncaughtExceptionHandler(fp)
          

          possibly ther may be a way with applicationWillTerminate_, or c.sighandler.

          It is usually easier just to put logging statements in your python to figure out which obj call is crashing.

          1 Reply Last reply Reply Quote 0
          • shaun-h
            shaun-h last edited by

            Thanks for trying, I will go with trying to put log statements in, just thought it might be easier to catch if I missed something though.

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