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":