I try to open a directory using xdg-open in Ubuntu. It works if I run xdg-open ./dir in terminal. I have a Flask web app that opens directories using xdg-open in some situations. When I start the app from terminal in development mode (By running $ flask run ) it works and opens all directories without any problems. But when