[CLI] UnicodeEncodeError: 'ascii' codec can't encode character '\u2b50'
See original GitHub issueDescription
Using wandb through a SLURM job, I get an UnicodeEncodeError on some nodes on which code is being executed (not all).
I narrowed down the issue and the character that raises the error (not obvious from the original message) is the “white medium star”: \u2b50.
How to reproduce
Minimal script allowing to reproduce error: test.py
#!/usr/bin/env python
import wandb
wandb.init(reinit=True)
wandb.init(reinit=True)
launched with (SLURM command):
srun --pty test.py
Environment
- OS: Ubuntu 20.04
- Environment: anaconda
- Python 3.6.12
- WandB version: wandb-0.10.15
Backtrace
wandb: ERROR Abnormal program exit
Traceback (most recent call last):
File "/home/gva/wandb-client/wandb/sdk/wandb_init.py", line 689, in init
run = wi.init()
File "/home/gva/wandb-client/wandb/sdk/wandb_init.py", line 486, in init
run._on_start()
File "/home/gva/wandb-client/wandb/sdk/wandb_run.py", line 1431, in _on_start
self._display_run()
File "/home/gva/wandb-client/wandb/sdk/wandb_run.py", line 1230, in _display_run
click.style(project_url, underline=True, fg="blue"),
File "/home/gva/wandb-client/wandb/errors/term.py", line 41, in termlog
silent=not _show_info,
File "/home/gva/wandb-client/wandb/errors/term.py", line 94, in _log
click.echo(line, file=sys.stderr, nl=newline)
File "/home/gva/miniconda3/lib/python3.6/site-packages/click/utils.py", line 272, in echo
file.write(message)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 20-21: ordinal not in range(128)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "test.py", line 4, in <module>
wandb.init(reinit=True)
File "/home/gva/wandb-client/wandb/sdk/wandb_init.py", line 726, in init
six.raise_from(Exception("problem"), error_seen)
File "<string>", line 3, in raise_from
Exception: problem
self._display_run()
File "/home/gva/wandb-client/wandb/sdk/wandb_run.py", line 1230, in _display_run
click.style(project_url, underline=True, fg="blue"),
File "/home/gva/wandb-client/wandb/errors/term.py", line 41, in termlog
silent=not _show_info,
File "/home/gva/wandb-client/wandb/errors/term.py", line 94, in _log
click.echo(line, file=sys.stderr, nl=newline)
File "/home/gva/miniconda3/lib/python3.6/site-packages/click/utils.py", line 272, in echo
file.write(message)
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Azure CLI : UnicodeEncodeError: 'ascii' codec can't encode ...
I have installed azure-cli using pip2 on alpine. When using azure-cli, in "vm create" command, I am getting above error. az login #worked...
Read more >'ascii' codec can't encode character...' when using a Python ...
How do I get around the Python error "UnicodeEncodeError: 'ascii' codec can't encode character..." when using a Python script on the command line?...
Read more >'ascii' codec can't encode character '\u2716' in position 9 ...
The details of the failure are as follows: UnicodeEncodeError: 'ascii' codec can't encode character '\u2716' in position 9: ordinal not in range(128) File ......
Read more >1766445 – UnicodeEncodeError: 'ascii' codec can't encode ...
Bug 1766445 - UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in ... managercli: use encode('utf-8') in strings, 2021-01-17 17:23:50 UTC ...
Read more >charmap' codec can't encode character '\xa3' in position 151
UnicodeEncodeError : 'charmap' codec can't encode characters in position 6-9: ... 'ascii' codec can't decode byte 0xc5 in position 223: ordinal not in ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have the same problem, the solution proposed by Gabriel works for me. Thanks mate!
a quick fix is to change the following in the final block of
_logdefined inwandb/errors/term.py: