Closed
Description
I am attempting to run a program which uses TTYColoredFormatter
from colorlog. This class formats log messages, adding ANSI escape codes only if the stream it is writing to returns True
for stream.isatty()
.
Unfortunately, python-for-android's bootstrap code replaces sys.stderr and sys.stdout with a custom LogFile
object:
This object doesn't implement isatty()
(or much else, for that matter). As a result, the program raises an exception:
03-03 13:32:56.222 5806 5891 I python : Traceback (most recent call last):
03-03 13:32:56.222 5806 5891 I python : File "/home/jenkins/workspace/kolibri-installer-android-pr/src/main.py", line 3, in <module>
03-03 13:32:56.222 5806 5891 I python : File "/home/jenkins/workspace/kolibri-installer-android-pr/src/kolibri_android/main_activity/__main__.py", line 7, in main
03-03 13:32:56.222 5806 5891 I python : File "/home/jenkins/workspace/kolibri-installer-android-pr/src/kolibri_android/main_activity/activity.py", line 19, in <module>
03-03 13:32:56.222 5806 5891 I python : File "/home/jenkins/workspace/kolibri-installer-android-pr/src/kolibri_android/kolibri_utils.py", line 13, in <module>
03-03 13:32:56.223 5806 5891 I python : File "/home/jenkins/workspace/kolibri-installer-android-pr/src/kolibri_android/android_whitenoise.py", line 11, in <module>
03-03 13:32:56.223 5806 5891 I python : File "/home/jenkins/workspace/kolibri-installer-android-pr/src/kolibri/__init__.py", line 10, in <module>
03-03 13:32:56.223 5806 5891 I python : File "/home/jenkins/workspace/kolibri-installer-android-pr/src/kolibri/utils/env.py", line 29, in <module>
03-03 13:32:56.223 5806 5891 I python : File "/home/jenkins/workspace/kolibri-installer-android-pr/src/kolibri/dist/colorlog/colorlog.py", line 203, in __init__
03-03 13:32:56.223 5806 5891 I python : AttributeError: 'LogFile' object has no attribute 'isatty'
(For reference, we're using colorlog v3.2.0, so the code raising the exception looks like this: https://github.com/borntyping/python-colorlog/blob/v3.2.0/colorlog/colorlog.py#L191-L211).
Metadata
Metadata
Assignees
Labels
No labels