【问题标题】:IOError: [Errno 0] Error while writing to output of Powershell in VSCodeIOError:[Errno 0] 在 VSCode 中写入 Powershell 输出时出错
【发布时间】:2017-07-18 09:02:36
【问题描述】:

这是我在运行 docker-compose 时在 VSCode 中遇到的错误。

PS D:\Work\Imho\Api> docker-compose -f docker-compose.yml up
Creating network "api_default" with the default driver
Pulling ignite (apacheignite/ignite:latest)...
latest: Pulling from apacheignite/ignite
5040bd298390: Pulling fs layer
fce5728aad85: Pulling fs layer

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose\cli\main.py", line 68, in main
  File "compose\cli\main.py", line 118, in perform_command
  File "compose\cli\main.py", line 926, in up
  File "compose\project.py", line 401, in up
  File "compose\service.py", line 305, in ensure_image_exists
  File "compose\service.py", line 1001, in pull
  File "compose\progress_stream.py", line 37, in stream_output
  File "codecs.py", line 370, in write
  File "site-packages\colorama\ansitowin32.py", line 40, in write
  File "site-packages\colorama\ansitowin32.py", line 141, in write
  File "site-packages\colorama\ansitowin32.py", line 169, in write_and_convert
  File "site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
IOError: [Errno 0] Error
Failed to execute script docker-compose

docker-compose.yml:

version: '3'
services:
  ignite:
    image: apacheignite/ignite

这个错误只发生在我的 3 台机器中的一台上,所以我不知道是什么原因造成的。重置为出厂默认设置或重新安装 docker 和 vscode 无济于事。如果没有 docker compose,图像将被拉出,然后工作正常。所有机器都在 Windows 10 上并安装了最新的稳定版 docker。

这是我在github上打开的issue。似乎这种行为只发生在 VSCode powershell 控制台中,而不发生在常规的 powershell 控制台中。建议更改编码的解决方案没有帮助。

【问题讨论】:

  • 就像,你为什么要让自己的事情变得更难......
  • 我想让事情变得更简单,只运行 vscode 而不是分别运行 vscode 和 powershell =)
  • vscode powershell shell 就是这么垃圾,不知道你为什么要使用它
  • 我猜是因为之前没有人告诉我这是垃圾
  • 我在 windows 下也遇到了类似的问题。就我而言,该项目包含一些似乎是问题的非 UTF-8 文件。相同的命令,相同的代码通过使用 git bash 解决了您在 github 中打开的错误中提到的问题

标签: python powershell visual-studio-code colorama


【解决方案1】:

解决方案:在 Windows 10 上更新到 1803。如果无法更新,请使用外部命令提示符。

Python 脚本也会发生同样的事情。显然,这是一个 Windows 更新问题:

https://github.com/Microsoft/vscode/issues/36630#issuecomment-359969098

编辑:由于我的公司限制更新,我的解决方法是在 VS Code 中使用外部终端

【讨论】:

    猜你喜欢
    • 2023-03-15
    • 1970-01-01
    • 2015-03-26
    • 1970-01-01
    • 2012-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-17
    相关资源
    最近更新 更多