python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.44k stars 587 forks source link

[WinError 5] When attempting to use Electron #454

Closed cutethingg closed 3 years ago

cutethingg commented 3 years ago

I'm attempting to open the electron browser through Eel in Python 3.9.0. I'm using an administrator command prompt to run the python scrips, so I'm not sure why I'm still being denied access.

Here's my Python script:

import eel
eel.init('web')

eel.start('index.html', size=(800, 600), block=False, mode='custom', cmdline_args=[r'C:\Users\UserName\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\root\nexit\web\node_modules\electron', '.'])

while True:
    eel.sleep(10)

This script works fine with the 'edge' or 'chrome-app' mode and without the commandline args, though I'm sure the command line path is correct. Here's my error:

Traceback (most recent call last):
  File "C:\Users\UserName\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\root\nexit\new.py", line 5, in <module>
    eel.start('index.html', size=(800, 600), block=False, mode='custom', cmdline_args=[r'C:\Users\UserName\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\root\nexit\web\node_modules\electron', '.'])
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python39-32\lib\site-packages\eel\__init__.py", line 158, in start
    show(*start_urls)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python39-32\lib\site-packages\eel\__init__.py", line 186, in show
    brw.open(start_urls, _start_args)
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python39-32\lib\site-packages\eel\browsers.py", line 51, in open
    sps.Popen(options['cmdline_args'],
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python39-32\lib\subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\UserName\AppData\Local\Programs\Python\Python39-32\lib\subprocess.py", line 1416, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Access is denied

Desktop:

cutethingg commented 3 years ago

From this site.

Winerror 5 is caused by attempting to access a directory as a file. This is not an issue with Eel.