Forum Archive

Emulator/on device, how to get rid of debugging console after closing app?

WTFruit

So I've been having a ton of fun doing all my work in xcode now and running in the simulator, and just now I started sideloading onto my phone as well. It's great. I even figured out how to force landscape and hide the statusbar as well so I've been pretty happy!

The one thing is... I can't figure out any way to eliminate the console which appears after the app is closed. Currently I close my final scene with

mainview.close()

Which, again, quits the app but presents the debugging console. What are my options?

cvp

if you want to go back to the home screen, you
- buy the "launcher" app
- modify your script to

import webbrowser
  • terminate your script with
webbrowser.open('launcher://crash')
dgelessus

Or you can just kill Python with os.abort().

But why do you have a way to close your app from within the app? When it's designed to run in Pythonista, that makes sense, because you need to be able to close it somehow. But if it's meant to be a standalone app, you already have a standard way of closing it - the home button. So you can simply take out whatever "exit" button you have and you don't need to worry about being unable to exit the app.

WTFruit

@ dgelessus

Good point, I was focused on solving the perceived problem and didn't even think about that. However, what would happen in the case of a hypothetical crash? Is there any way for it to ever "unintentionally" land on the debugging console?

JonB

An uncaught Exception could show the console... show just be sure to catch all exceptions, perhaps logging them instead.

dgelessus

It might be useful to write a top-level except BaseException as exc handler that logs the exception, and then crash on purpose with os.abort(). That's probably more user-friendly than showing the debug console with a traceback, or silently logging the exception and pretending that nothing happened.