Skip to content

Commit 2e052e4

Browse files
authored
Fix encoding exception when using %%capture magic (#3310)
1 parent 66df6aa commit 2e052e4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

wandb/util.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,9 +1376,8 @@ def uri_from_path(path: Optional[str]) -> str:
13761376

13771377
def is_unicode_safe(stream: TextIO) -> bool:
13781378
"""returns true if the stream supports UTF-8"""
1379-
if not hasattr(stream, "encoding"):
1380-
return False
1381-
return stream.encoding.lower() in {"utf-8", "utf_8"}
1379+
encoding = getattr(stream, "encoding", None)
1380+
return encoding.lower() in {"utf-8", "utf_8"} if encoding else False
13821381

13831382

13841383
def _has_internet() -> bool:

0 commit comments

Comments
 (0)