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

Malformed characters when using "pipx run file:[file.py]" command with Rich library #1358

Open
regiellis opened this issue Apr 20, 2024 · 1 comment
Labels

Comments

@regiellis
Copy link

regiellis commented Apr 20, 2024

Describe the bug

When using pipx file:[file.py] on a file importing the Rich Library system the display seems to be malformed when using tables
and progress bars. If I run this normally using the standard python command with the libraries installed; Both in and out of
a virtualenv and on 2 different windows machine in both CMDER and Fluent Terminal...it works as expected.

python 3.11
pipx 1.5.0

I have made sure to try all the steps on the Troubleshooting page before submitting

How to reproduce

Running the script with Rich library installed using the script comment at the top of the file;

# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "typer",
#   "rich",
# ]
# ///

pipx_rich_error

Expected behavior

See included screen gif

Rich output from python -m rich

Screenshot 2024-04-19 204049

@mike-clark-8192
Copy link

mike-clark-8192 commented Apr 27, 2024

It might have something to do with the charset encoding settings of the stdout/stderr pipeline connection between console <-> pipx <-> python. I repro'd this with:

  1. richmain.py:
# /// script
# requires-python = ">=3.11"
# dependencies = [ "typer", "rich" ]
# ///
import runpy
runpy.run_module("rich.__main__", run_name="__main__")
  1. execute: pipx run file:richmain.py
  2. repro.

afterwards you can run to test this has no repro:

$cachedir = pipx environment -V PIPX_VENV_CACHEDIR
$venv = dir $cachedir -dir | sort lastmodifiedtime -descending | select -first 1
& "$venv\scripts\activate.ps1"
python -m rich

(probably need to be using Windows Terminal to support this kind of rich output)

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

No branches or pull requests

3 participants