Skip to content

[CEF] Exceptions with webview.settings on Python 3.8. #1330

@definite-d

Description

@definite-d

Specification

  • pywebview version: 5.0.4
  • Operating System: Windows 7 (Python 3.8.10)
  • Web Renderer: CEF (cefpython3 66.1)

Description

TLDR: It seems CEF launches different sub-versions depending on the environment's Python version, and the one for Python 3.8 doesn't like webview.settings.

If the cef renderer is used with Python 3.8, this exception occurs (I've redacted my installation path):

Traceback (most recent call last):
  File "test.py", line 5, in <module>
    webview.start(gui='cef')
  File "C:\[redacted]\Python\Python38-32\lib\site-packages\webview\__init__.py", line 209, in start
    guilib.create_window(windows[0])
  File "C:\[redacted]\Python\Python38-32\lib\site-packages\webview\platforms\winforms.py", line 578, in create_window
    CEF.init(window, cache_dir)
  File "C:\[redacted]\Python\Python38-32\lib\site-packages\webview\platforms\cef.py", line 288, in init
    cef.Initialize(settings=all_settings, commandLineSwitches=all_command_line_switches)
  File "cefpython_py38.pyx", line 629, in cefpython_py38.Initialize
  File "settings.pyx", line 133, in cefpython_py38.SetApplicationSettings
Exception: Invalid appSettings key: ALLOW_DOWNLOADS

Example Code:
Any code will do as long as the cef renderer is used with Python 3.8:

import webview

if __name__ == '__main__':
    webview.create_window('CEF browser', 'https://pywebview.flowrl.com/hello')
    webview.start(gui='cef')

Using the settings dict...

webview.settings = {
  'ALLOW_DOWNLOADS': False,
  'ALLOW_FILE_URLS': True,
  'OPEN_EXTERNAL_LINKS_IN_BROWSER': True,
  'OPEN_DEVTOOLS_IN_DEBUG': True
}

...and removing the ALLOW_DOWNLOADS key only gives a similar exception for ALLOW_FILE_URLS, which in this case cannot just be removed as it appears to be depended on within pywebview.

Practicalities

  • YES I am willing to work on this issue myself.

  • NO I am not prepared to support this issue financially.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions