'OSError: [Errno 24] Too many open files but ulimit already set high

I am trying to make a small visualisation tool using Flask however I keep having the error

OSError: [Errno 24] Too many open files

The error occurs when I add the python module "dependencies" import to the file. The module works perfectly fine outside so I don't understand why I get this error

This is the code

from flask import Flask, render_template

from dependencies.simulation import Simulation

app = Flask(__name__)

@app..route("/")
def index():
    return render_template("index.html")

if __name__ == "__main__":
    app.run(debug=True)

I have set my ulimit to

ulimit -n 10240

but it doesn't change anything

Any help would be great, I have already lost a lot of time on this !



Sources

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

Source: Stack Overflow

Solution Source