gstaff / flask-ngrok

A simple way to demo Flask apps from your machine.
Other
138 stars 58 forks source link

PermissionError: [Errno 13] Permission denied: '/tmp/ngrok/ngrok' #20

Open ghost opened 3 years ago

ghost commented 3 years ago

This is my code

from flask import Flask
from flask_ngrok import run_with_ngrok

app = Flask(__name__)
run_with_ngrok(app)

@app.route("/")
def hello():
    return "Hello Geeks!! from Google Colab"

app.run()

When I run it, I get the following error:

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Serving Flask app "server" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 1254, in run
    self.function(*self.args, **self.kwargs)
  File "/home/muhammadmehdi/PycharmProjects/memex/venv/lib/python3.8/site-packages/flask_ngrok.py", line 70, in start_ngrok
    ngrok_address = _run_ngrok()
  File "/home/muhammadmehdi/PycharmProjects/memex/venv/lib/python3.8/site-packages/flask_ngrok.py", line 31, in _run_ngrok
    ngrok = subprocess.Popen([executable, 'http', '5000'])
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/tmp/ngrok/ngrok'

I installed flask-ngrok in PyCharm. I even changed read and write permissions (chmod -R 755 /tmp/ngrok/ngrok) but I still get the same error as above.

adaj commented 3 years ago

I'm also having this, but since I'm in a macOS, I got PermissionError: [Errno 13] Permission denied: '/var/folders/hh/vz60ml8n45q2bw6b4_zltsqc0000gn/T/ngrok/ngrok. I tried downgrading flask-ngrok to 0.0.23 and flask to 0.12.2, but the same error appears.

saar-win commented 3 years ago

try with sudo

djangoliv commented 3 years ago

I am facing the same issue but I can't used sudo :( is there any chance of having another solution?

irbraga commented 3 years ago

I fixed it replacing the line #30 (flask_ngrok.py) from: os.chmod(executable, 777) to: os.chmod(executable, stat.S_IEXEC) # Make file for the current user executable.

importing lib stat from python core...

My OS specifications:

LSB Version: core-11.1.0ubuntu2-noarch:printing-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch Distributor ID: Linuxmint Description: Linux Mint 20.1 Release: 20.1 Codename: ulyssa

I dno1t know if its ok for other OS...

VikashKothary commented 2 years ago

See: https://github.com/gstaff/flask-ngrok/issues/2

Olney1 commented 2 years ago

I have the same issue on Mac and VS Code. Did anyone find a solution for Mac?

AlwaysBeCalm commented 5 months ago

This solution fixed it for me.