-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
Describe the bug
See pypa/pip#11036 (comment) for the original report and reproducer.
Broadly, importing rich fails with a FileNotFoundError
since it tries to lookup cwd unconditionally, but it is possible to cwd to not exist.
❯ mkdir y
❯ cd y
❯ rm -rf ../y
❯ python -c "import rich"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/rich-cwd-issue/.venv/lib/python3.9/site-packages/rich/__init__.py", line 16, in <module>
_IMPORT_CWD = os.path.abspath(os.getcwd())
FileNotFoundError: [Errno 2] No such file or directory
Platform
Click to expand
What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
This is not relevant, but MacOS and VSCode's integrated terminal. :)
❯ python -m rich.diagnose
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface. │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=180 ColorSystem.TRUECOLOR> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ color_system = 'truecolor' │
│ encoding = 'utf-8' │
│ file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│ height = 26 │
│ is_alt_screen = False │
│ is_dumb_terminal = False │
│ is_interactive = True │
│ is_jupyter = False │
│ is_terminal = True │
│ legacy_windows = False │
│ no_color = False │
│ options = ConsoleOptions( │
│ size=ConsoleDimensions(width=180, height=26), │
│ legacy_windows=False, │
│ min_width=1, │
│ max_width=180, │
│ is_terminal=True, │
│ encoding='utf-8', │
│ max_height=26, │
│ justify=None, │
│ overflow=None, │
│ no_wrap=False, │
│ highlight=None, │
│ markup=None, │
│ height=None │
│ ) │
│ quiet = False │
│ record = False │
│ safe_box = True │
│ size = ConsoleDimensions(width=180, height=26) │
│ soft_wrap = False │
│ stderr = False │
│ style = None │
│ tab_size = 8 │
│ width = 180 │
╰──────────────────────────────────────────────────────────────────────────────────╯
╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
│ Windows features available. │
│ │
│ ╭───────────────────────────────────────────────────╮ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ ╰───────────────────────────────────────────────────╯ │
│ │
│ truecolor = False │
│ vt = False │
╰───────────────────────────────────────────────────────╯
╭────── Environment Variables ───────╮
│ { │
│ 'TERM': 'xterm-256color', │
│ 'COLORTERM': 'truecolor', │
│ 'CLICOLOR': '1', │
│ 'NO_COLOR': None, │
│ 'TERM_PROGRAM': 'vscode', │
│ 'COLUMNS': None, │
│ 'LINES': None, │
│ 'JPY_PARENT_PID': None, │
│ 'VSCODE_VERBOSE_LOGGING': None │
│ } │
╰────────────────────────────────────╯
platform="Darwin"
❯ pip freeze | grep rich
rich==12.2.0