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

RichHandler file/line info malformed on GitLab CI runner #2551

Closed
awgymer opened this issue Sep 28, 2022 · 3 comments
Closed

RichHandler file/line info malformed on GitLab CI runner #2551

awgymer opened this issue Sep 28, 2022 · 3 comments

Comments

@awgymer
Copy link

awgymer commented Sep 28, 2022

I am not sure if this is an issue with the GitLab CI runner or rich and I assume it may be the former but perhaps there is some setting in rich I can adjust?

When using the logging handler the filename and line number are displayed as follows, rather than as the filename and line number in grey. Something with the ansi code seems borked?
The output looked normal when run locally on Mac.

INFO     Test passed  [✔]                                            d=144076;file:///usr/local/lib/python3.10/site-packages/tools/build.py2mbuild.py:d=781518;file:///usr/local/lib/python3.10/site-packages/tools/build.py#852m85

EDIT: I tried adding PYTHONIOENCODING=utf8 which was mentioned in an older issue but this had no impact.

@willmcgugan
Copy link
Collaborator

Looks like it is GitLib that is borked. It is stripping ansi codes for links incorrectly. You could set the env vat TERM=dumb to not write escape codes.

@jzenoz
Copy link

jzenoz commented Jun 6, 2024

TERM=dumb didn't work for me with FORCE_COLOR set despite what it says in the console api page (doesn't work for the logging handler?):
https://rich.readthedocs.io/en/stable/console.html#environment-variables

If the environment variable FORCE_COLOR is set, then color/styles will be enabled regardless of the value of TERM. This is useful on CI systems which aren’t terminals but can none-the-less display ANSI escape sequences.

disabling show_path fixed this issue for me:
handlers=[RichHandler(show_path=False)],

Also for awareness you'll also end up with this issue:
#2647

Copy link

github-actions bot commented Jul 2, 2024

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

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

No branches or pull requests

3 participants