Skip to content
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

General: Ignore decode error of stdout/stderr in run_subprocess #4446

Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions openpype/hosts/harmony/plugins/publish/extract_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def process(self, instance):
output = process.communicate()[0]

if process.returncode != 0:
raise ValueError(output.decode("utf-8"))
raise ValueError(output.decode("utf-8", errors="backslashreplace"))

self.log.debug(output.decode("utf-8"))
self.log.debug(output.decode("utf-8", errors="backslashreplace"))

# Generate representations.
extension = collection.tail[1:]
Expand Down
4 changes: 2 additions & 2 deletions openpype/lib/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ def run_subprocess(*args, **kwargs):
full_output = ""
_stdout, _stderr = proc.communicate()
if _stdout:
_stdout = _stdout.decode("utf-8")
_stdout = _stdout.decode("utf-8", errors="backslashreplace")
full_output += _stdout
logger.debug(_stdout)

if _stderr:
_stderr = _stderr.decode("utf-8")
_stderr = _stderr.decode("utf-8", errors="backslashreplace")
# Add additional line break if output already contains stdout
if full_output:
full_output += "\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ def info_about_input(oiiotool_path, filepath):
_stdout, _stderr = popen.communicate()
output = ""
if _stdout:
output += _stdout.decode("utf-8")
output += _stdout.decode("utf-8", errors="backslashreplace")

if _stderr:
output += _stderr.decode("utf-8")
output += _stderr.decode("utf-8", errors="backslashreplace")

output = output.replace("\r\n", "\n")
xml_started = False
Expand Down
6 changes: 2 additions & 4 deletions openpype/scripts/otio_burnin.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,11 @@ def render(self, output, args=None, overwrite=False, **kwargs):

_stdout, _stderr = proc.communicate()
if _stdout:
for line in _stdout.split(b"\r\n"):
print(line.decode("utf-8"))
print(_stdout.decode("utf-8", errors="backslashreplace"))

# This will probably never happen as ffmpeg use stdout
if _stderr:
for line in _stderr.split(b"\r\n"):
print(line.decode("utf-8"))
print(_stderr.decode("utf-8", errors="backslashreplace"))

if proc.returncode != 0:
raise RuntimeError(
Expand Down