0

Hello i am trying to run a py function but gives me 2 errors and I dont know what to do can some one help me pls.

Error 1: http://localhost/web/eel.js net::ERR_ABORTED 404 (Not Found) Error 2: Uncaught ReferenceError: eel is not defined at hello.html:6 (anonymous) @ hello.html:6

Folder: https://i.stack.imgur.com/aeQFS.png

HTML:

<!DOCTYPE html>
<html>
    <head>
        <script type="text/javascript" src="eel.js"></script>
        <script type="text/javascript">
            eel.hello("hiiii");
        </script>
    </head>
    <body>
        
    </body>
</html>

PYTHON:

import eel
eel.init('web')
eel.start('hello.html', size=(300, 200))

@eel.expose
def hello(x):
    print('Hello from %s' % x)
    f = open("myfile.txt", "x")

1 Answers1

0

Try moving eel.start('hello.html', size=(300, 200)) to the bottom of your Python file. You should expose the hello function before calling eel.start(<args>).

Like this:

import eel
eel.init('web')

@eel.expose
def hello(x):
    print('Hello from %s' % x)

eel.start('hello.html', size=(300, 200))
dstricks
  • 1,465
  • 12
  • 23