context.run prints the codes of unicode chars from the output instead of printing the unicode characters themselves
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the issue with the provided task and invoke black, then inspect the output handling used by Context.run. Compare its behavior with direct black src and subprocess.run; done means Unicode characters such as ✨ and 🍰 are printed directly rather than as escape codes.
Written by the indexing model from the issue text.
Description
Create this simple task:
from invoke.tasks import task
from invoke.context import Context
@task
def black(c: Context) -> None:
"""Formats code with `black`."""
c.run("black src")
Run the task with invoke:
invoke black
The invoke prints the code of the unicode chars returned by the black in its output:
All done! \u2728 \U0001f370 \u2728
...
However, this is the expected output (the output of running directly black src):
All done! ✨ 🍰 ✨
...
Executing black with subprocess.run produces the expected result:
Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.run("black src")
All done! ✨ 🍰 ✨
...
CompletedProcess(args='black src', returncode=0)
>>>
- Dominant language
- Python
- Stars
- 4.8k
- Forks
- 412
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pyinvoke/invoke
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100