Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Attempted fix for windows cp1252 encoding failure (#3687)

adeshpande93cf85cd427c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a2a06b25c..b750abb2b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,6 +18,7 @@ jobs:
env:
DISPLAY: :0
PYTEST_ADDOPTS: "--color=yes" # colors in pytest
+ PYTHONIOENCODING: "utf8"
strategy:
fail-fast: false
matrix:
diff --git a/manim/utils/commands.py b/manim/utils/commands.py
index 2ec9a776d..bcb205eb6 100644
--- a/manim/utils/commands.py
+++ b/manim/utils/commands.py
@@ -14,7 +14,14 @@ __all__ = [
def capture(command, cwd=None, command_input=None):
- p = run(command, cwd=cwd, input=command_input, capture_output=True, text=True)
+ p = run(
+ command,
+ cwd=cwd,
+ input=command_input,
+ capture_output=True,
+ text=True,
+ encoding="utf-8",
+ )
out, err = p.stdout, p.stderr
return out, err, p.returncode
diff --git a/tests/test_logging/test_logging.py b/tests/test_logging/test_logging.py
index 1bbc59de0..ca209482a 100644
--- a/tests/test_logging/test_logging.py
+++ b/tests/test_logging/test_logging.py
@@ -43,8 +43,10 @@ def test_error_logging(tmp_path, python_version):
str(path_error_scene),
]
- _, err, exitcode = capture(command)
- assert exitcode != 0 and len(err) > 0
+ out, err, exitcode = capture(command)
+ if err is None:
+ err = out
+ assert exitcode != 0 and "Traceback (most recent call last)" in err
@logs_comparison(