Ajinkya
Ajinkya

Reputation: 1887

Google Colab ngrok convert to python

I have a Google Colab notebook with following commands

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

!unzip ngrok-stable-linux-amd64.zip

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

These commands run very well without any error in Google Colab . But when I run the same in python get error.

Python demo.py

import sys, json
import requests
from IPython import get_ipython
import requests

LOG_DIR = './log'

get_ipython().system_raw(
    'tensorboard --logdir {} --host 0.0.0.0 --port 8001 &'
    .format(LOG_DIR)
)

ERROR: line 9: AttributeError: 'NoneType' object has no attribute 'system_raw'

How do I resolve this error in python ?

Upvotes: 0

Views: 1598

Answers (1)

alexdlaird
alexdlaird

Reputation: 1293

Might I suggest trying something like pyngrok to programmatically manage your ngrok tunnel for you? Full disclosure, I am the developer of it. Here are the docs if you're interest.

Upvotes: 1

Related Questions