【问题标题】:Paperboy throwing error: TypeError: the JSON object must be str, not 'bytes'?Paperboy 抛出错误:TypeError:JSON 对象必须是 str,而不是 'bytes'?
【发布时间】:2019-12-03 10:12:15
【问题描述】:

我已经按照https://github.com/timkpaine/paperboy.git 中给出的步骤安装了paperboy

并使用

执行
python3 -m paperboy

从 UI 上传笔记本时

当点击保存按钮 UI 没有响应但在控制台上抛出以下错误

CRITICAL:root:list : <class 'paperboy.storage.sqla.models.report.ReportSQL'>, result : 0 - 0
[2019-12-03 15:26:01 +0530] [24991] [ERROR] Error handling request /api/v1/notebooks?action=save
Traceback (most recent call last):
 File "/usr/local/lib/python3.5/dist-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
 File "/usr/local/lib/python3.5/dist-packages/gunicorn/workers/sync.py", line 176, in handle_request
   respiter = self.wsgi(environ, resp.start_response)
 File "/usr/local/lib/python3.5/dist-packages/falcon/api.py", line 244, in __call__
    responder(req, resp, **params)
 File "/home/exa00112/xstream/paperboy/paperboy/resources/notebook.py", line 21, in on_post
   resp.body = json.dumps(self.db.notebooks.store(req.context['user'], req.params, self.session))
 File "/home/exa00112/xstream/paperboy/paperboy/storage/sqla/notebook.py", line 44, in store
    notebook = nbformat.writes(strip_outputs(nbformat.reads(params.get('file').file.read(), 4)))
 File "/usr/local/lib/python3.5/dist-packages/nbformat/__init__.py", line 74, in reads
    nb = reader.reads(s, **kwargs)
 File "/usr/local/lib/python3.5/dist-packages/nbformat/reader.py", line 58, in reads
    nb_dict = parse_json(s, **kwargs)
 File "/usr/local/lib/python3.5/dist-packages/nbformat/reader.py", line 14, in parse_json
    nb_dict = json.loads(s, **kwargs)
 File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

【问题讨论】:

    标签: python jupyter-notebook airflow


    【解决方案1】:

    使用master分支安装paperboyhttps://github.com/timkpaine/paperboy.git

    git clone https://github.com/timkpaine/paperboy.git
    cd paperboy
    conda create --name python3.7 python=3.7
    conda activate python3.7
    npm install
    npm run build
    pip install -e .
    

    然后打开

    paperboy/server/deploy_nix.py
    

    将第 2 行更改为

    from six import iteritems #from gunicorn.six import iteritems
    

    然后运行

    python -m paperboy
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-13
      • 1970-01-01
      • 2019-08-27
      • 2017-08-11
      • 2019-10-10
      • 2017-08-31
      • 2017-11-01
      • 2018-04-26
      相关资源
      最近更新 更多