From 5100a2be526a3ef517cd25676b055bf6c06f12b9 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Fri, 22 Apr 2022 09:52:53 +0100 Subject: [PATCH] fix import cwd if no cwd --- rich/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rich/__init__.py b/rich/__init__.py index 853d792a7..07bc1a192 100644 --- a/rich/__init__.py +++ b/rich/__init__.py @@ -13,7 +13,11 @@ # Global console used by alternative print _console: Optional["Console"] = None -_IMPORT_CWD = os.path.abspath(os.getcwd()) +try: + _IMPORT_CWD = os.path.abspath(os.getcwd()) +except FileNotFoundError: + # Can happen if the cwd has been deleted + _IMPORT_CWD = "" def get_console() -> "Console":