Amira Elsayed Ismail
Amira Elsayed Ismail

Reputation: 9414

PermissionError: [Errno 13] Permission denied in python project

I am working on an application that needs installation for airnotifier, I have followed the installation instruction in the following link:

https://github.com/dcai/airnotifier/wiki/Installation-3.x

on the last command of running app.py I got the following error

airnotifier@airnotifier:~/airnotifier$ pipenv run python app.py
app.py:73: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
  logging.warn("Sentry dsn is not set")
[W 220718 20:08:43 app:73] Sentry dsn is not set
[I 220718 20:08:43 routes:73] init route: controllers.auth
[I 220718 20:08:43 routes:73] init route: controllers.base
[I 220718 20:08:43 routes:73] init route: controllers.broadcast
[I 220718 20:08:43 routes:73] init route: controllers.keys
[I 220718 20:08:43 routes:73] init route: controllers.newapp
[I 220718 20:08:43 routes:73] init route: controllers.settings
[I 220718 20:08:43 routes:73] init route: controllers.tokens
[I 220718 20:08:43 routes:73] init route: api.accesskeys
[I 220718 20:08:43 routes:73] init route: api.broadcast
[I 220718 20:08:43 routes:73] init route: api.push
[I 220718 20:08:43 routes:73] init route: api.tokens
Traceback (most recent call last):
  File "app.py", line 95, in <module>
    WebApplication(container).main()
  File "/home/airnotifier/airnotifier/web.py", line 146, in main
    http_server.listen(options.port)
  File "/home/airnotifier/.local/share/virtualenvs/airnotifier-dIcrTSca/lib/python3.8/site-packages/tornado/tcpserver.py", line 151, in listen
    sockets = bind_sockets(port, address=address)
  File "/home/airnotifier/.local/share/virtualenvs/airnotifier-dIcrTSca/lib/python3.8/site-packages/tornado/netutil.py", line 174, in bind_sockets
    sock.bind(sockaddr)
PermissionError: [Errno 13] Permission denied
airnotifier@airnotifier:~/airnotifier$

I checked the permissions of the files and searched a lot but couldn't find a way to solve this problem

Upvotes: 1

Views: 6142

Answers (2)

Jay Prakash Maurya
Jay Prakash Maurya

Reputation: 1

If you are facing these issues:

error: <class 'PermissionError'>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py

you need to use sudo like restart celery then sudo supervisorctl restart all

Upvotes: 0

Esther
Esther

Reputation: 480

You need to run with sudo, as stated in the installation instructions you linked. As you see, the error comes from trying to bind a socket to a port. Most probably it's trying to use a privileged port (<1024), which can only be done with elevated permissions (ie sudo).

Upvotes: 5

Related Questions