-
-
Notifications
You must be signed in to change notification settings - Fork 574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can`t access python code: unhashable type: 'ConfigParser' #1442
Comments
Additional fact: with pywebview version 4.4.1 everything works fine! |
Prefix your configparser variable with an underscore to omit it from serialization. Nested JS API was intoduced in 5.0 and as the result it tries to expose everything in the api class recursively. Error check should probably be added there to gracefully handle scenarios like this. |
I replaced set with a list in the |
Ohh wow, thank you very much. I will try it and send you feedback! |
I tried it out, used the master branch, but had no luck & got another Exception:
|
I am not sure if this is related to the initial issue... |
It looks like a separate issue. What does your API object looks like? Could you get an original exception out of this? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The message to post on the issue when closing it. If none provided, will not comment when closing an issue. |
Specification
pywebview version: 5.1
operating system: Windows 11 Pro 23H2
web renderer: WinForms / Chromium / Bottle v0.12.25
pip status:
Package - Version
bottle - 0.12.25
cffi - 1.16.0
clr-loader - 0.2.6
pip - 23.2.1
proxy-tools - 0.1.0
pycparser - 2.22
pyserial - 3.5
pythonnet - 3.0.3
pywebview - 5.1
pywin32 - 306
typing_extensions - 4.12.2
Description
I have a problem that I can`t access any python function from JavaScript side.
JavaScript Error:
TypeError: pywebview.api.xyz is not a function
Terminal Output:
[pywebview] unhashable type: 'ConfigParser'
Traceback (most recent call last):
File "C:\Users\GitLab.venv\Lib\site-packages\webview\util.py", line 188, in inject_pywebview
func_list = generate_func()
^^^^^^^^^^^^^^^
File "C:\Users\GitLab.venv\Lib\site-packages\webview\util.py", line 176, in generate_func
functions = get_functions(window._js_api)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\GitLab.venv\Lib\site-packages\webview\util.py", line 171, in get_functions
get_functions(attr, full_name, functions)
File "C:\Users\GitLab.venv\Lib\site-packages\webview\util.py", line 154, in get_functions
if obj in exposed_objects:
^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'ConfigParser'
I am using the python configparser.ConfigParser object in one of my functions in Python.
Thank you very much!
Practicalities
YES I am willing to work on this issue myself.
NO I am not prepared to support this issue financially.
The text was updated successfully, but these errors were encountered: