Unable to debug with CEF on Windows
See original GitHub issueSpecification
- pywebview version: 3.3.5
- platform / version: Windows + CEF
Description
debug=True
doesn’t propagate properly from start()
While trying to get the debugger working in CEF, I noticed that as soon as create_window
calls CEF.init(window)
the value of _debug
flips from True
to False
for some reason. They seem to be in the same thread, so I can only gather that it has something to do with the nature of declaring global _debug
and changing it in start()
doesn’t change it where it’s imported, sometimes. It seems fine in winforms.py but not in cef.py. Maybe because cef is conditionally imported? Dropping a breakpoint at line 72 https://github.com/r0x0r/pywebview/blob/952b3115c1b3b884e6a4d213a0a031bdea9e6609/webview/platforms/winforms.py#L71-L73 shows me that after this import, CEF._debug
== False
instead of True
.
I actually came to post that I didn’t understand why, but I put a breakpoint on the line in cef.py where _debug is imported, and I realized that I was importing cef.py long before _debug
is set to true in order to get to cef.settings
. I don’t know why it became disjointed and lost the fact that the reference changed, but it feels like maybe this should be a is_debug()
function in __init__.py
instead of relying on it being a global variable.
Unfortunately there’s no workaround since you can’t pass the settings. I can’t change the settings after start() is called, and I can’t import it before either. The best I can do is force setting webview._debug=True
and then importing cef.settings
after that.
Practicalities
-
YES I am willing to work on this issue myself.
-
NO I am not prepared to support this issue financially.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (8 by maintainers)
Top GitHub Comments
The message to post on the issue when closing it. If none provided, will not comment when closing an issue.
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.