Skip to content

Fix different behavior for jupyter vs. terminal #788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmdstanpy/utils/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import subprocess
import sys
import locale
from typing import Callable, List, Optional, TextIO

from .filesystem import pushd
Expand Down Expand Up @@ -47,6 +48,7 @@ def do_command(
stderr=subprocess.STDOUT, # avoid buffer overflow
env=os.environ,
universal_newlines=True,
encoding=locale.getdefaultlocale()[1],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's too bad encoding='locale' and locale.getencoding() are only available on newer versions. I think locale.getpreferredencoding(False) is the best option for older versions

)
while proc.poll() is None:
if proc.stdout is not None:
Expand Down
Loading