pythonpaneljupyter-lab

Jupyter Lab - How to change to UTF-8 when I am using the jupyter lab panel?


When I try to use panel in jupyter lab, it shows the error, how I solve it? (besides changing OS language)

[E 2024-04-04 11:39:28.809 ServerApp] Uncaught exception GET /panel-preview/render/ch06.ipynb (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/panel-preview/render/ch06.ipynb', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "E:\ProgramFile\python311\Lib\site-packages\tornado\web.py", line 1790, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "E:\ProgramFile\python311\Lib\site-packages\panel\io\jupyter_server_extension.py", line 247, in get
        nb = json.load(f)
             ^^^^^^^^^^^^
      File "E:\ProgramFile\python311\Lib\json\__init__.py", line 293, in load
        return loads(fp.read(),
                     ^^^^^^^^^
    UnicodeDecodeError: 'cp950' codec can't decode byte 0xc3 in position 8713: illegal multibyte sequence

https://live.staticflickr.com/65535/53629775482_795929816a_o.png

Expected result: The panel should be shown.


Solution

  • After I set the Environment variable "PYTHONIOENCODING=utf-8" in my PC, restart, I can use panel now