pythoneel

Python Eel: "Access Denied"


I'm trying to use Eel to make a simple application, but when I run this simple code:

import eel
from os import getcwd
eel.init("web")
eel.start(getcwd() + "\\main.html")

It gives me this error:

Error: 403 Forbidden

If it's important, here is the html code, just a placeholder to test:

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <body>
    <h1>Test</h1>
  </body>
</html>

I've tried changing ownership of the file to 'Everyone' and giving full access, but that didn't do anything. I couldn't find anything about this online when I searched for it, so if anyone knows how to fix this, please let me know. TIA!


Solution

  • This app.py worked for me:

    import eel
    
    if __name__ == '__main__':
        eel.init(".")
        eel.start("main.html")
    

    With my directory structure:

    /project
      |app.py
      |main.html
    

    With the code you posted, you would need a directory structure like:

    /project
      |app.py
      /web
        |main.html