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

并使用执行

python3 -m paperboy

从UI上传笔记本时

python - Paperboy throw 错误:TypeError:JSON对象必须为str,而不是“bytes”吗?-LMLPHP

当单击保存按钮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'

最佳答案

使用master分支安装paperboy https://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

10-04 21:46