#5970·xonsh

env: unexpected expanding string to path

Author: anki-codeCreated Dec 1, 2025Updated Jun 15, 2026
Labelsenvironv1
xsh
with @.env.swap(QWE="~"):
    echo $QWE
# /home/user

Expected ~ as an output.

It looks this is old bug. I can reproduce on xonsh 0.18.

Workaround is using @():

xsh
with @.env.swap(QWE="~"):
    echo @($QWE)
# ~

For community

⬇️ Please click the reaction instead of leaving a +1 or comment