Skip to content

Commit 5100a2b

Browse files
committed
fix import cwd if no cwd
1 parent 0ed9309 commit 5100a2b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rich/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
# Global console used by alternative print
1414
_console: Optional["Console"] = None
1515

16-
_IMPORT_CWD = os.path.abspath(os.getcwd())
16+
try:
17+
_IMPORT_CWD = os.path.abspath(os.getcwd())
18+
except FileNotFoundError:
19+
# Can happen if the cwd has been deleted
20+
_IMPORT_CWD = ""
1721

1822

1923
def get_console() -> "Console":

0 commit comments

Comments
 (0)