'run ngrok using subprocess. how to use subprocess with both ip address and port?

Is that correct what i did ?...

ngrok = subprocess.Popen([make_executable, 'http', '127.0.0.2', '-inspect=false','-bind-tls=true', port])

#This is the full code

def runNgrok():
ngrokDir = "/home/ubuntu/ngrokFunctionalities"
port = 8081
ngrok_command = "ngrok"
make_executable = str(Path(ngrokDir, ngrok_command))
ngrok = subprocess.Popen([make_executable, 'http', '127.0.0.2', '-inspect=false','-bind-tls=true', port])
atexit.register(ngrok.terminate)
time.sleep(7)
return True

I'm using python3.8 Try to run in Raspberry pi B 4

  File "ngrokRunKeepAlive.py", line 25
ngrok = subprocess.Popen([make_executable, 'http', 127.0.0.2, '-inspect=false','-bind-tls=true', port])
                                                        ^

SyntaxError: invalid syntax



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source