Skip to content

Commit 353c734

Browse files
t-kalinowskilucianopaz
authored andcommitted
replace usage of sys.stdout.encoding with sys.getdefaultencoding()
In some environments, `sys.stdout.encoding` may return `None`. This is encountered when knitting an rmarkdown document using the reticulate engine. In that context, `sys.stdout` is replaced with a `StringIO()` object to capture all output. `StringIO().encoding` returns `None` closes rstudio/reticulate#1508
1 parent b63ee0c commit 353c734

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pytensor/link/c/cmodule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2743,7 +2743,7 @@ def get_cxx_library_dirs():
27432743

27442744
maybe_lib_dirs = [
27452745
[pathlib.Path(p).resolve() for p in line[len("libraries: =") :].split(":")]
2746-
for line in stdout.decode(sys.stdout.encoding).splitlines()
2746+
for line in stdout.decode(sys.getdefaultencoding()).splitlines()
27472747
if line.startswith("libraries: =")
27482748
]
27492749
if len(maybe_lib_dirs) > 0:

0 commit comments

Comments
 (0)