You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#1029 reported an issue with PyInstaller that was resolved for the original reporter with the logwriter-bottle branch that was merged in #1038.
For me this does not fix the issue, because bottle, which is causing the problem, requires stdout and stderr to exist before it is even imported. On Windows, neither pythonw nor PyInstaller support this.
To replicate without needing PyInstaller, run the pywebview Hello World example with pythonw rather than python. This is a regression since pywebview version 4.0 because of the introduction of bottle.
One fix would be to import bottleafter the new DummyLogWriter, and change the hasattr(sys, '_MEIPASS') check in http.py to instead check for stdout and stderr existing (similar to how this used to work in PyInstaller).
The root cause is that bottle, for almost its entire existence until relatively recently, tested for the write method of stdout and stderr, but only caught an IOError, not an AttributeError. This was fixed in 2021, but it doesn't seem like a new PyPi release is coming anytime soon, so most pywebview users will probably have the latest version (0.12.23) that does not include this change.
I'm happy to submit a PR, but thought you might have your own preferred way of resolving things like this that are related to importing dependencies.
The text was updated successfully, but these errors were encountered:
Bottle.py versions prior to 0.12.23 (the latest on PyPi as of Feb 2023) require stdout and stderr to exist when that package is imported, which is not the case on Windows when using pythonw.exe or PyInstaller >= 5.8.0.
This is similar to the recently-merged PR r0x0r#1038 that fixedr0x0r#1029, but this fix only works if using bottle.py 0.13-dev, which is unlikely in most cases given that this version is not on PyPi (note that the fix it contains was committed over two years ago in January 2021).
This change uses a `TemporaryFile` instead of `DummyLogWriter` to resolve the issue.
Fixesr0x0r#1044.
#1029 reported an issue with PyInstaller that was resolved for the original reporter with the logwriter-bottle branch that was merged in #1038.
For me this does not fix the issue, because
bottle
, which is causing the problem, requiresstdout
andstderr
to exist before it is even imported. On Windows, neitherpythonw
nor PyInstaller support this.To replicate without needing PyInstaller, run the pywebview Hello World example with
pythonw
rather thanpython
. This is a regression since pywebview version 4.0 because of the introduction ofbottle
.One fix would be to import
bottle
after the newDummyLogWriter
, and change thehasattr(sys, '_MEIPASS')
check inhttp.py
to instead check forstdout
andstderr
existing (similar to how this used to work in PyInstaller).The root cause is that
bottle
, for almost its entire existence until relatively recently, tested for thewrite
method ofstdout
andstderr
, but only caught anIOError
, not anAttributeError
. This was fixed in 2021, but it doesn't seem like a new PyPi release is coming anytime soon, so most pywebview users will probably have the latest version (0.12.23) that does not include this change.I'm happy to submit a PR, but thought you might have your own preferred way of resolving things like this that are related to importing dependencies.
The text was updated successfully, but these errors were encountered: