尝试使用Google Colab Notebook复制实施Tensorboard时的语法错误

时间:2019-01-01 17:35:20

标签: python python-3.x tensorflow tensorboard google-colaboratory

我正在尝试重新创建用户joppe-geluykens对以下问题的回答:Can I use Tensorboard with Google Colab?

根据他的回答,这是我的代码。

LOG_DIR = '/tmp/log'
get_ipython().system_raw(
    'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &'
    .format(LOG_DIR)
)

! wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-windows-amd64.zip
! unzip ngrok-stable-windows-amd64.zip


get_ipython().system_raw('./ngrok http 6006 &')

上面的代码似乎可以在Google笔记本中正常运行,这是我收到如下语法错误的最后一步:

! curl -s http://localhost:4040/api/tunnels | python3 -c \
    "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.6/json/__init__.py", line 299, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

任何建议将不胜感激。谢谢。

0 个答案:

没有答案