0

I am using eel to communicate with python. I'm working in dir C:\Users\Desktop\Eel where I have app.py and inside the UI folder I have index.html, myjava.js, style.css, images but nothing called eel.js. I said this because in docs it says to include script called /eel.js.


index.html

<head>
    <script type="text/javascript" language="JavaScript" src="./myjava.js"></script>
    <script type="text/javascript" src="/eel.js"></script>
    <link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container" onclick="runeel()">
</body>

my Javascript is:

function runeel(){
    eel.runpy()
}

app.py

import eel

eel.init('UI')
eel.start('index.html', size=(900, 550))

@eel.expose
def runpy():
     ....code which creates an excel file in desktop...

When I run the py file, the index.html loads up and then when I click the div I get into the function and but it throws the error:

myjava.js:2 Uncaught TypeError: eel.runpy is not a function

What am I missing?

ɐsɹǝʌ ǝɔıʌ
  • 4,440
  • 3
  • 35
  • 56
hawaes
  • 1
  • 1
  • 1

3 Answers3

1

It seems that the init statement is written first. What about writing the @eel.expose statement right after the import statement?

I'm not good at English, so I'm worried that it will make sense. But I would be happy if I could help.

0

In my case, I had to start eel after exposing the function via the decorator:

import eel

eel.init('UI')

@eel.expose
def runpy():
     ....code which creates an excel file in desktop...

eel.start('index.html', size=(900, 550))
JASON G PETERSON
  • 2,193
  • 1
  • 18
  • 19
0

i had the same problem until I removed the /eel.js from

<script type="text/javascript" src="/eel.js"></script>

now it's look like

<script type="text/javascript" src="eel.js"></script>
David
  • 9
  • 4