来自外部文件的输入在调试时与Microsoft Python与代码扩展

发布于 2025-01-28 18:21:44 字数 718 浏览 1 评论 0原文

在调试时,我正在尝试按照VS代码文档中的建议读取输入,此处(通过添加“ args”:[<“,input.txt”)到启动.json)。它不起作用,因为Microsoft的Python扩展程序将自动逃脱(py -lt;“”)(用“ \ \”)自动逃脱(请参见下面的控制台输出)。

cd /workspaces/pyt ; /usr/bin/env /usr/local/bin/python /home/vscode/.vscode-server/extensions/ms-python.python-2022.7.11332232/pythonFiles/lib/python/debugpy/launcher 41587 -- /workspaces/pyt/test.py \< input.txt 

从外部文件读取输入的方式确实与其他VS代码扩展相关,例如使用C/C ++。有什么方法可以使其与Python扩展程序(在调试时)使用?

While debugging, I am trying to read input from external file as advised in the VS Code docs here (by adding "args" : ["<", "input.txt"] to launch.json). It doesn't work as the redirect ("<") is automatically escaped (prepended with "\") by the Microsoft's Python extension (see the console output below).

cd /workspaces/pyt ; /usr/bin/env /usr/local/bin/python /home/vscode/.vscode-server/extensions/ms-python.python-2022.7.11332232/pythonFiles/lib/python/debugpy/launcher 41587 -- /workspaces/pyt/test.py \< input.txt 

This way of reading input from external file does work with other VS Code extensions, for example with C/C++. Is there any way to make it work with the Python extension (while debugging)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

堇年纸鸢 2025-02-04 18:21:44

已在VSCODE 1.67.2中求解,

请尽快更新。

This has been solved in Vscode 1.67.2

Please update as soon as possible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文