Cannot save. UnicodeDecodeError

92 views
Skip to first unread message

Kenji Kina

unread,
Jul 27, 2016, 2:24:21 AM7/27/16
to Project Jupyter
I recently installed the official Tensorflow CPU Docker image which comes with Jupyter Notebook.

I can use it without any trouble, but it won't save at all. Whenever it tries to autosave, it drops me a small nondescript message. Also, every time I try to save and checkpoint, it gives me the following error:



Extracted from the browser inspector I get the following text:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/notebook/base/handlers.py", line 457, in wrapper
    result = yield gen.maybe_future(method(self, *args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1015, in run
    value = future.result()
  File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 237, in result
    raise_exc_info(self._exc_info)
  File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 285, in wrapper
    yielded = next(result)
  File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/handlers.py", line 234, in put
    model = self.get_json_body()
  File "/usr/local/lib/python2.7/dist-packages/notebook/base/handlers.py", line 326, in get_json_body
    body = self.request.body.strip().decode(u'utf-8')
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x81 in position 4477: invalid start byte

I've changed the locale of my docker container's OS (Ubuntu Linux) to explicit en_US.UTF-8 and en_US.ISO-8859-1 but it hasn't helped.

I am at my wits end. Can anyone give me a hand with this?

Thomas Kluyver

unread,
Jul 27, 2016, 4:34:27 PM7/27/16
to Project Jupyter
Is it different with a different browser? The error looks like the browser is producing JSON that's not valid UTF-8, which as far as I know should never be the case.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/2c57f6db-fab4-4be3-a32c-7cd3385f53e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kenji Kina

unread,
Jul 27, 2016, 5:50:54 PM7/27/16
to Project Jupyter
The message originally happened on Chrome, but I just tried on Firefox and Edge and I get the same result.

Thomas Kluyver

unread,
Jul 28, 2016, 6:39:09 AM7/28/16
to Project Jupyter
Does it work if you clear all output before saving? Can you give detailed steps to reproduce it?

Kenji Kina

unread,
Jul 30, 2016, 9:56:17 PM7/30/16
to Project Jupyter
Yes, I did as follows:
  1. Installed Docker on my Windows 10 PC, configured for Hyper-V. Windows region configuration is United States, but locale is Spanish - Peru. 
  2. Downloaded the Tensorflow CPU Docker container.
  3. Ran as is, and had issues saving outright.
  4. Updated every package through apt and pip as far as I know, still had issues.
  5. Configured the container's locale as en_US.UTF-8, es_ES.UTF-8, en_US.ISO-8859-1, es_ES.ISO-8859-1. None made any difference
That's where I am right now.

Kenji Kina

unread,
Jul 30, 2016, 10:06:04 PM7/30/16
to Project Jupyter
Just tried again now and it's working normally. I am not sure which of the steps I tried solved the issue. Anyways, feel free to ignore this thread now. 

Thank you very much for your time.

Kenji Kina

unread,
Jul 30, 2016, 10:10:52 PM7/30/16
to Project Jupyter
For future reference, the latest Docker update was what probably solved the issue, probably one of these:

  • Support for UTF-8 in Dockerfiles #23372
  • Skip UTF-8 BOM bytes from Dockerfile and .dockerignore if exist #23234
The update was pushed to my PC just today.

Thomas Kluyver

unread,
Jul 31, 2016, 4:51:31 AM7/31/16
to Project Jupyter
I don't think supporting UTF-8 in Dockerfiles would have any bearing on what the browser sends to the server when saving a notebook, but if it's working for you now, I'm inclined to write it off as a corner case, at least until it comes up again.

Reply all
Reply to author
Forward
0 new messages