sacred icon indicating copy to clipboard operation
sacred copied to clipboard

utf-8 codec error

Open angusturner opened this issue 7 years ago • 10 comments

Am encountering the following error mid-experiment.

File "/home/ubuntu/miniconda3/envs/cuda/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/ubuntu/miniconda3/envs/cuda/lib/python3.6/threading.py", line 1182, in run
    self.function(*self.args, **self.kwargs)
  File "/home/ubuntu/miniconda3/envs/cuda/lib/python3.6/site-packages/sacred/run.py", line 266, in _start_heartbeat
    self._emit_heartbeat()
  File "/home/ubuntu/miniconda3/envs/cuda/lib/python3.6/site-packages/sacred/run.py", line 333, in _emit_heartbeat
    self._get_captured_output()
  File "/home/ubuntu/miniconda3/envs/cuda/lib/python3.6/site-packages/sacred/run.py", line 257, in _get_captured_output
    text = text.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 0: invalid start byte

angusturner avatar Jun 01 '17 02:06 angusturner

Update: issue seems to be resolved when I disabled tqdm. There must be a way to fix though?

angusturner avatar Jun 01 '17 02:06 angusturner

That should not happen indeed. I'll dig into it next week. Is it enough to use the standard tqdm progressbar for reproducing this?

BTW: I wasn't aware of tqdm, but it seems extremely cool! Thanks :-)

Qwlouse avatar Jun 08 '17 16:06 Qwlouse

I still encounter similar issue sometimes with tqdm=4.15.0 and sacred=0.7.1

wheatdog avatar Sep 21 '17 17:09 wheatdog

Issues confirmed here also with tqdm:

File "/home/myhome/venv/lib/python3.5/site-packages/sacred/run.py", line 257, in _get_captured_output text = text.decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0x88 in position 0: invalid start byte

tqdm uses special characters to return at the beginning of line or even at the previous line (so it can update nested progress bars simultaneously on several lines). A (free) guess is that this character is the problem for text.decode() ?

fcharras avatar Sep 26 '17 14:09 fcharras

@Qwlouse maybe it should be re opened ? (the first issue was caused by byte 0x96, now it's 0x88)

fcharras avatar Sep 26 '17 14:09 fcharras

Guys, why don't you just add "ignore" to text.decode? It's only a output log.

omikronsc avatar Dec 08 '17 08:12 omikronsc

I've run into it as well and it looks so far that just using tqdm(..., ascii=True) doesn't brick sacred.

PiotrSokol avatar Jan 22 '18 18:01 PiotrSokol

I think this issue should be fixed now, so I'm closing it.

Qwlouse avatar Feb 06 '18 10:02 Qwlouse

Thanks a lot !!!

fcharras avatar Jun 15 '18 06:06 fcharras

Hi I am still getting this error:

with the latest version of tqdm and sacred...

Traceback (most recent call last):

File "/usr/lib/python2.7/contextlib.py", line 35, in exit self.gen.throw(type, value, traceback)

File "/usr/local/lib/python2.7/dist-packages/sacred/stdout_capturing.py", line 109, in tee_output_python out.finalize()

File "/usr/local/lib/python2.7/dist-packages/sacred/stdout_capturing.py", line 83, in finalize self.final = self.get()

File "/usr/local/lib/python2.7/dist-packages/sacred/stdout_capturing.py", line 72, in get self.buffer.seek(self.read_position)

File "/usr/lib/python2.7/StringIO.py", line 106, in seek self.buf += ''.join(self.buflist)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1254: ordinal not in range(128)

xXBasti avatar Aug 02 '19 12:08 xXBasti