SyntaxError in validate-modern.py due to unescaped newline in f-string
Windows Version
Microsoft Windows [Versions 10.0.26100.4061]
WSL Version
2.4.13.0
Are you using WSL 1 or WSL 2?
- [x] WSL 2
- [ ] WSL 1
Kernel Version
5.15.167.4-1
Distro Version
Ubuntu 20.04
Other Software
No response
Repro Steps
Running distributions/validate-modern.py with Python 3.8+ raises a SyntaxError:
File "distributions/validate-modern.py", line 157
print(f'::error file={manifest},line={line}::Error: {format_list(text).replace('\n', '%0A')}')
^
SyntaxError: unexpected character after line continuation character
Expected Behavior
No error.
Actual Behavior
Error!
Diagnostic Logs
This is caused by an unescaped newline (\n) being used inside a nested f-string expression. Python's f-string parsing does not allow certain escape sequences inside {}.
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1
The script will output the path of the log file once done.
If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here
Once completed please upload the output files to this Github issue.
Click here for more info on logging If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.
WslLogs-2025-05-26_20-21-54.zip The WSL logs is attached.
Diagnostic information
Detected appx version: 2.4.13.0
Fixed by #12977