eliottree
eliottree copied to clipboard
Argument Error when use eliot tree
Test code:
from eliot import log_call, to_file
to_file(open('log.log', 'w'))
@log_call(action_type='CALC', include_args=['x'], include_result=True)
def calculate(x, y):
return x * y
x = 2
y = 10
result = calculate(x, y)
print(result)
Then use eliot-tree log.log
it returns an Argument Error.
Exceptions (1) occurred during processing:
Traceback (most recent call last):
File "C:\Users\paule\Anaconda3\lib\site-packages\toolz\functoolz.py", line 781, in __call__
return self.func(*args, **kwargs)
File "C:\Users\paule\Anaconda3\lib\site-packages\eliottree\_render.py", line 117, in format_node
format.escape_control_characters(node.root().task_uuid)))
File "C:\Users\paule\Anaconda3\lib\site-packages\eliottree\_color.py", line 43, in __color
return colored(text, fg, bg, attrs=attrs)
File "C:\Users\paule\Anaconda3\lib\site-packages\eliottree\_color.py", line 30, in colored
_colored.fg(fg) if fg is not None else u'',
File "C:\Users\paule\Anaconda3\lib\site-packages\colored\colored.py", line 402, in fg
return colored(color).foreground()
File "C:\Users\paule\Anaconda3\lib\site-packages\colored\colored.py", line 22, in __init__
self.enable_windows_terminal_mode()
File "C:\Users\paule\Anaconda3\lib\site-packages\colored\colored.py", line 373, in enable_windows_terminal_mode
hStdout = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
@RyuAsuka It looks this is an issue with the colored library that eliot-tree is using. Can you try eliot-tree --color never log.log
to see if disabling color helps?
@RyuAsuka Can you also provide information about what version of Windows and Python you're using? There is a Windows builder in CI that isn't failing (to my knowledge) so there must be something peculiar about your setup.
@jonathanj
I have tried eliot-tree --color never log.log
and the exceptions do not appear again.
My OS is Windows 10 1909 v18363.900, Python version is 3.7.7 with anaconda 4.8.3. I simply use anaconda to install eliot-tree by conda install -c conda-forge eliot eliot-tree
The test program and eliot-tree
command works normally in Ubuntu 18.04.