From 9692794b88e352643088c6661ad06d9be6d6061f Mon Sep 17 00:00:00 2001 From: Tyler Cook <10459406+cilki@users.noreply.github.com> Date: Tue, 8 Nov 2022 20:56:54 -0600 Subject: [PATCH 1/2] Fix syntax error when building with nuitka --- rich/pretty.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rich/pretty.py b/rich/pretty.py index 7de32da2..b3bea5c2 100644 --- a/rich/pretty.py +++ b/rich/pretty.py @@ -247,7 +247,7 @@ def install( ) builtins._ = value # type: ignore[attr-defined] - try: # pragma: no cover + if "get_ipython" in globals(): ip = get_ipython() # type: ignore[name-defined] from IPython.core.formatters import BaseFormatter @@ -272,7 +272,7 @@ def install( # replace plain text formatter with rich formatter rich_formatter = RichFormatter() ip.display_formatter.formatters["text/plain"] = rich_formatter - except Exception: + else: sys.displayhook = display_hook From 34a3935cf49216c4c53b23a2faa165e789a0a804 Mon Sep 17 00:00:00 2001 From: Tyler Cook <10459406+cilki@users.noreply.github.com> Date: Sun, 4 Dec 2022 15:47:07 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d355ae60..d346dd84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Reversed `pre` and `code` tags in base HTML format https://github.com/Textualize/rich/pull/2642 +- Fix syntax error when building with nuitka https://github.com/Textualize/rich/pull/2635 ### Changed