Open patarapolw opened 2 days ago
Can you find out where in the pywebview code this error originates from?
The error occurs on posting to Python, always at VM25:488, which is
This error occurs on the Python side, when you call you function via JS API. See webview/util.py
lines 214-222.
I would start by checking code in your function first.
For example, both of these functions give the same errors.
def log(self, obj):
pprint(obj, indent=1, sort_dicts=False)
def mark(self, v: str, t: str):
# v is a Chinese word. t is an English keyword.
While functions that only send Chinese letters to the web are done successful without errors.
def get_stats(self):
return self.latest_stats # dict containing Chinese characters.
Note that the errors only occur after running the app packaged with pyinstaller --noconsole
, while packaging with console doesn't bear errors.
This is a Pyinstaller issue. Here is for example an old Stack Overflow thread https://stackoverflow.com/questions/47692960/error-when-using-pyinstaller-unicodedecodeerror-utf-8-codec-cant-decode-byt According to this it should have been fixed, but apparently the issue still persists.
Not the same issue, at least; as I can compile, with or without --noconsole
.
My guess is, on compiling with --noconsole
, there is no way to set encoding, and it defaults to Windows's. On with console, some unknown env var might do something. (PYTHONUTF8
and PYTHONIOENCODING
aren't set.)
Specification
Description
Not while developing, but running the program packaged with PyInstaller 6.10.0
--noconsole
.pywebview.api.*
doesn't work if Chinese characters are included in the arguments. The error is visible in the JavaScript console, not in the terminal.Practicalities
YES I am willing to work on this issue myself.
NO I am prepared to support this issue financially.