env: unexpected expanding string to path
Author: anki-codeCreated Dec 1, 2025Updated Jun 15, 2026
Labelsenvironv1
with @.env.swap(QWE="~"):
echo $QWE
# /home/userExpected ~ as an output.
It looks this is old bug. I can reproduce on xonsh 0.18.
Workaround is using @():
with @.env.swap(QWE="~"):
echo @($QWE)
# ~For community
⬇️ Please click the reaction instead of leaving a +1 or comment
Source: xonsh/xonsh