Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

pet server logs warnings as ANSI-colored stderr, shown as errors

Aperta
#571 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@karthiknadig ci sta già lavorando.

Dal 5/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

Problem: Since #314, pet server writes its diagnostics as ANSI-colored text on stderr instead of sending log notifications. The VS Code Python Environments extension logs every stderr chunk at error level, so routine warnings show up as [error] lines full of escape codes in the Python Environments output channel.

For example, on a Windows machine with only per-user Python installs, every startup logs:

[error] [pet] ␛[2m   0.008930700s␛[0m ␛[33m WARN␛[0m ␛[2mpet_windows_registry::environments␛[0m␛[2m:␛[0m Failed to open HKLM\Software\Python, Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }

Output channel filtered to [pet]: a WARN line logged as [error], with ESC control characters

These are the first "errors" users and triagers see in logs. Of 33 microsoft/vscode-python-environments issues that quote [error] [pet] lines, 15 include warnings logged this way (as ^[[33m WARN^[[0m), mostly pet_conda::package: Unable to find conda package … and pet_windows_registry::environments: Failed to open HKLM\Software\Python. For example microsoft/vscode-python-environments#1370 (71 such lines), microsoft/vscode-python-environments#1099 and microsoft/vscode-python-environments#1491.

Cause:

Suggested fix:

  • In server mode, forward tracing events as log notifications with their level (a tracing layer that reuses pet_reporter::jsonrpc::Log), and keep stderr for panics.
  • Disable ANSI colors when stderr is not a terminal (.with_ansi(std::io::stderr().is_terminal())).
  • Optionally, in the extension: log stderr by the level token in each line, not as errors.

Environment: Windows 11, VS Code 1.140.0, PET main @ 4ca7c03 with Python Environments main @ 52f6ace.

Steps to verify fix:

  1. On Windows without a machine-wide Python (no HKLM\Software\Python key), open a Python file in VS Code with Python Environments.
  2. Open the Output panel, select Python Environments, and filter by [pet].
  3. Verify the Failed to open HKLM\Software\Python message is logged as [warning] (or not at all at the default level) and contains no ␛[ sequences.
  4. Point python.defaultInterpreterPath at a missing file and reload; verify PET's resolve failure is still logged as [error].
  5. Run pet find 2> err.txt and verify err.txt has no ANSI escape codes.

Found by Copilot

Lingua principale
Rust
Stelle
207
Fork
45
Merge medio
1g 4h
PR unite (30g)
18

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/python-environment-tools

Tutte le issue di microsoft/python-environment-tools

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.