Skip to content

sys.stdout.isatty() fails in function "set_msconsole()" in file "_console.py" #128

@hans-fritz-pommes

Description

@hans-fritz-pommes
Traceback (most recent call last):  File "C:\Users\HansFritzPommes\Documents\app.py", line xy, in <module>
    from isbntools.app import meta
  File "C:\Users\HansFritzPommes\AppData\Local\Programs\Python\Python312\Lib\site-packages\isbntools\app.py", line 32, in <module>
    from ._initapp import config, registry, CONF_PATH, CACHE_FILE
  File "C:\Users\HansFritzPommes\AppData\Local\Programs\Python\Python312\Lib\site-packages\isbntools\_initapp.py", line 174, in <module>
    set_msconsole()
  File "C:\Users\HansFritzPommes\AppData\Local\Programs\Python\Python312\Lib\site-packages\isbntools\_console.py", line 108, in set_msconsole
    if not sys.stdout.isatty():
AttributeError: 'NoneType' object has no attribute 'isatty'

I get this error when I use a program using isbntools compiled with cx-freeze.
I think, this error happens because sys.stdout is None in this case, because I use a cx-freeze so called WIN32GUI application, which drops all requests to sys.stdout.
My recommendation:
in file "_console.py":
in function set_msconsole():

try:
    if not sys.stdout.isatty():
        return
except AttributeError:
    return

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions