Skip to content

Commit 4dec798

Browse files
authored
Merge pull request #2212 from Textualize/fix-cwd
fix import cwd if no cwd
2 parents 0ed9309 + 5100a2b commit 4dec798

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)