@philip.scadding, I updated my config to use Desktop 2.4.14, and I am still getting the behavior where a Python error is not being reported via the console. It will get to the line of code where the error would be caught, and then the App just freezes and does not report anything. The error I am generating is print foo
where foo has never been defined. I would expect to see Python throw a NameError: name 'foo' is not defined
. But, there is nothing, it just sits there.
Hi Mark
I tested again here is what I found:
If I added the print to an area of the app code that would be run when registering the app command, then I would get the error logged to the tk-desktop.log
but it would not appear in the console. The app would not then show as an icon in Desktop.
If I added the print to an area of the app that would get called during execute, then I get the error logged to both tk-desktop.log
and the console.
Also, the freezing of the app is slightly odd, and I wonder if that is the key to the issue of it not logging. Usually, an app won’t freeze on an error like that if it has a GUI, certainly, in my tests the app does not freeze.
@philip.scadding, I am able to do the same where the icon will not show if there is a problem registering the app command in Toolkit. The freezing happens when the error happens at runtime inside the code while processing. The app has a small GUI and is using the engine.show_busy()
dialog message. I would be happy to hop on a Zoom session to demo this happening, live. If you would like.
Hey hey,
Here’s an update from my end. I’m now on the latest version of tk-desktop and I’m still having the same behavior. After dealing with this for awhile, here is what seems to be happening:
- Exceptions in init_app are silently ignored - not logged anywhere.
- Exceptions raised during the initialization of my Qt dialog are displayed in an error window.
- Exceptions raised after my dialog’s initialization (signal callbacks etc.) are silently ignored. If I wrap this same code in a try-except block and raise the exception myself, it is handled normally and appears in the console.
Hopefully this helps you narrow things down.
I’ve actually been looking at the way the Desktop engine handles the logging for a separate reason, and I think I now understand a bit more.
When Desktop is loading the app for the project, that logging is never getting passed to SG Desktop main UI process, however it should as far as I can see, and I’ve tested, still get output to the tk-desktop.log
. So that explains why you wouldn’t see it in the console, but I’m still not sure why you are not getting a message in the log file. I get an error like this:
App /Users/.../tk-multi-pythonconsole failed to initialize. It will not be loaded: ...