textual: Textual app silently crashes without printing exception to stdout
Workaround
I can’t reproduce this when the dev console is attached. You can open the dev console in one terminal using textual console and launch your app with textual run --dev <yourprogram.py> in order to (probably) work around this issue.
import json
from pathlib import Path
from rich.text import Text
from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, Static
class TreeApp(App):
    BINDINGS = [
        ("a", "add", "Add node"),
    ]
    def compose(self) -> ComposeResult:
        yield Header()
        yield Footer()
        yield Static("Press A to crash")
    def action_add(self) -> None:
        raise Exception("This error should print")
if __name__ == "__main__":
    app = TreeApp()
    app.run()
Open app, press A, no output on stdout. Weirdly I did get stdout errors once or twice, so apologies for the heisenbug. If you can’t reproduce this I’ll try posting my frozen dependencies and all that.
# Textual Diagnostics
## Versions
| Name    | Value  |
|---------|--------|
| Textual | 0.14.0 |
| Rich    | 13.3.2 |
## Python
| Name           | Value                                                                                  |
|----------------|----------------------------------------------------------------------------------------|
| Version        | 3.10.9                                                                                 |
| Implementation | CPython                                                                                |
| Compiler       | GCC 12.2.0                                                                             |
| Executable     | /home/traverseda/.cache/pypoetry/virtualenvs/pyadminconsole-Ykr_Mx4S-py3.10/bin/python |
## Operating System
| Name    | Value                                                      |
|---------|------------------------------------------------------------|
| System  | Linux                                                      |
| Release | 6.2.2-zen1-1-zen                                           |
| Version | #1 ZEN SMP PREEMPT_DYNAMIC Fri, 03 Mar 2023 15:58:29 +0000 |
## Terminal
| Name                 | Value          |
|----------------------|----------------|
| Terminal Application | *Unknown*      |
| TERM                 | xterm-256color |
| COLORTERM            | truecolor      |
| FORCE_COLOR          | *Not set*      |
| NO_COLOR             | *Not set*      |
## Rich Console options
| Name           | Value                |
|----------------|----------------------|
| size           | width=236, height=55 |
| legacy_windows | False                |
| min_width      | 1                    |
| max_width      | 236                  |
| is_terminal    | True                 |
| encoding       | utf-8                |
| max_height     | 55                   |
| justify        | None                 |
| overflow       | None                 |
| no_wrap        | False                |
| highlight      | None                 |
| markup         | None                 |
| height         | None                 |

About this issue
- Original URL
 - State: closed
 - Created a year ago
 - Comments: 20 (5 by maintainers)
 
Flushing stdout before writing the traceback.
I have two MacBook Pros. One an older Intel, one an M1.