Skip to content

fix: DualOutput object has no attribute isatty #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025

Conversation

HollowMan6
Copy link
Contributor

I encontered this error when I submit a slurm job in HPC, although sys.stdout doesn't have isatty here, it won't fail even if we don't set NO_COLORS, so I think it should be safe to skip the isatty check here under such condition.

File "colorful/init.py", line 133, in <module>
sys.modules[name] = ColorfulModule(Colorful(), name)
^^^^^^^^^^
File "colorful/core.py", line 342, in init
colormode = terminal.detect_color_support(env=os.environ)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "colorful/terminal.py", line 48, in detect_color_support
if not sys.stdout.isatty():
^^^^^^^^^^^^^^^^^
AttributeError: 'DualOutput' object has no attribute 'isatty'

I encontered this error when I submit a slurm job in HPC,
although `sys.stdout` doesn't have `isatty` here, it won't
fail even if we don't set `NO_COLORS`, so I think it should
be safe to skip the isatty check here under such condition.

```log
File "colorful/init.py", line 133, in <module>
sys.modules[name] = ColorfulModule(Colorful(), name)
^^^^^^^^^^
File "colorful/core.py", line 342, in init
colormode = terminal.detect_color_support(env=os.environ)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "colorful/terminal.py", line 48, in detect_color_support
if not sys.stdout.isatty():
^^^^^^^^^^^^^^^^^
AttributeError: 'DualOutput' object has no attribute 'isatty'
```

Signed-off-by: Hollow Man <[email protected]>
@fliiiix
Copy link
Collaborator

fliiiix commented Jun 30, 2025

sounds fair to me

@fliiiix fliiiix merged commit caccb89 into timofurrer:master Jun 30, 2025
@fliiiix
Copy link
Collaborator

fliiiix commented Jun 30, 2025

do you need this in a release?

@HollowMan6
Copy link
Contributor Author

do you need this in a release?

Thanks! I've already patched this locally, so I don't need a release for this.

@fliiiix
Copy link
Collaborator

fliiiix commented Jul 1, 2025

The CI stuff failed so i took the time to update that and created a release anyway so its also part of v0.5.7 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants