Skip to content

Commit b16db0c

Browse files
committed
issue with traceback on legacy windows
1 parent 3617dc4 commit b16db0c

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [1.0.1] - 2020-05-08
99

10+
### Fixed
11+
12+
- Issue with Windows legacy support https://github.com/willmcgugan/rich/issues/59
13+
14+
## [1.0.1] - 2020-05-08
15+
1016
### Changed
1117

1218
- Applied console markup after highlighting

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "rich"
33
homepage = "https://github.com/willmcgugan/rich"
44
documentation = "https://rich.readthedocs.io/en/latest/"
5-
version = "1.0.1"
5+
version = "1.0.2"
66
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
77
authors = ["Will McGugan <willmcgugan@gmail.com>"]
88
license = "MIT"

rich/console.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,12 @@ class ConsoleThreadLocals(threading.local):
210210
control: List[str] = field(default_factory=list)
211211

212212

213-
def _enable_legacy_windows_support() -> None:
214-
"""Initialize Windows legacy support."""
213+
def detect_legacy_windows() -> bool:
214+
"""Detect legacy Windows."""
215+
return "WINDIR" in os.environ and "WT_SESSION" not in os.environ
216+
217+
218+
if detect_legacy_windows():
215219
from colorama import init
216220

217221
init()
@@ -266,12 +270,11 @@ def __init__(
266270
self._markup = markup
267271
self._emoji = emoji
268272
self._highlight = highlight
269-
self.legacy_windows: bool = "WINDIR" in os.environ and not "WT_SESSION" in os.environ
273+
self.legacy_windows: bool = detect_legacy_windows()
270274

271275
self._color_system: Optional[ColorSystem]
272276
self._force_terminal = force_terminal
273277
if self.legacy_windows:
274-
_enable_legacy_windows_support()
275278
self.file = file or sys.stdout
276279
self._color_system = COLOR_SYSTEMS["windows"]
277280
else:

0 commit comments

Comments
 (0)