Skip to content
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

Argument Error when use eliot tree #97

Open
RyuAsuka opened this issue Jun 28, 2020 · 3 comments
Open

Argument Error when use eliot tree #97

RyuAsuka opened this issue Jun 28, 2020 · 3 comments

Comments

@RyuAsuka
Copy link

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
@jonathanj
Copy link
Owner

@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?

@jonathanj
Copy link
Owner

@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.

@RyuAsuka
Copy link
Author

RyuAsuka commented Jun 28, 2020

@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.

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

No branches or pull requests

2 participants