Skip to content

Commit

Permalink
Merge pull request #14 from davidhozic/develop
Browse files Browse the repository at this point in the history
Fixed .write call on sys.stdout if running without a console  (#12) (…
  • Loading branch information
davidhozic authored Sep 26, 2024
2 parents 0a9a9dd + 0f13a5a commit b1d8110
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Glossary
Releases
---------------------

v1.3.2
==================
- Fixed ``AttributeError: 'NoneType' object has no attribute 'write'`` exception when using PyInstaller with
``--noconsole`` option.


v1.3.1
==================
- Fixed *_tkinter.TclError: grab failed: window not viewable* error when ``pop_up`` was set to ``True``.
Expand Down
2 changes: 1 addition & 1 deletion tk_async_execute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
VERSION = "1.3.1"
VERSION = "1.3.2"

from .utils import *
from .widget import ExecutingAsyncWindow
4 changes: 3 additions & 1 deletion tk_async_execute/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ def write(self, text: str):
if text != "\n":
self.status_var.set(text)

self.old_stdout.write(text)
# Original sys.stdout can be None when using programs such as pyinstaller (with --noconsole option).
if self.old_stdout is not None:
self.old_stdout.write(text)

def destroy(self, future: asyncio.Future = None) -> None:
if future is not None and (exc := future.exception()) is not None and self.show_exceptions:
Expand Down

0 comments on commit b1d8110

Please sign in to comment.