-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run Python File in Terminal fails with & / ampersand in file path #8432
Comments
I am able to confirm this, thanks. |
I am having this issue as well on Mac. When I run debug a script, I see:
the This issue appears to be exactly the same as microsoft/vscode#66738, although that one involved a node script. This makes me wonder if the issue is actually with the debugger rather than with the python extension. |
This fails while using integrated terminal (
Console output:
and the This happens because, in BASH, the & sign has a special meaning. The actual problem is that there seems to be no way to escape it. This should work:
but it doesn't, because the single quotes
and so quoting makes no difference, other than further screwing the URL argument into As I understand it, the extension should not escape single quotes in the arguments. Note that this issue doesn't happen while using the internal console:
The problem with internal console is that now we lose all debugging output, which more or less defeats the purpose. Version: 1.44.2 |
I'm having the same problem as well. There is no way to escape Version: 1.45.1 |
Just want to mention, in addition to Linux and Mac, this issue happens in Windows (with CMD) as well. I think the cause is pretty straightforward: When the args (or file path) have spaces, VS Code will automatically quote them, so there is no ambiguity:
So for ampersands, VS Code should do the same, since otherwise it would be interpreted as something else by most of terminals as mentioned above, but it doesn't:
|
Any chance to have someone looking into this? It looks to me that this isn't hard to fix (quote it when there are ampersands in args string(s), just like what we already do for space), and the impact of the bug is relatively large: you can't debug anything with ampersand in args. With filenames, I can somewhat get away by renaming the files myself, but I can't really avoid them in args for things like URLs with query strings. Thanks! |
Facing the same issue. I am beginner. Let me check if I can debug this issue. |
Fixed by #18855. |
The Command "Run Python File in Terminal" does not escape special chars in the file path and execution fails with an error. In my case the file path contains an ampersand and the errors states that you can not use the &-char in string literals:
Environment data
"python.jediEnabled"
set to; more info How to update the language server to the latest stable version #3977): XXXExpected behaviour
The command should enclose the file path with double quotes.
This way the script executes correctly.
Thanks
The text was updated successfully, but these errors were encountered: