IOError:[Errno 0]在VSCode中写入Powershell的输出时出错

时间:2017-07-18 09:02:37

标签: python powershell visual-studio-code colorama

这是我在运行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

搬运工-compose.yml:

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

此错误仅发生在我的3台计算机之一上,所以我不知道是什么导致它。重置为出厂默认设置或重新安装docker和vscode无济于事。没有泊坞窗组成图像拉动然后工作正常。所有的机器都安装在Windows 10和最新的稳定码头上。

这是我在github上打开的issue。看来这种行为只发生在VSCode powershell控制台中,而不是在常规的PowerShell控制台中。改变编码的解决方案表明没有帮助。

1 个答案:

答案 0 :(得分:0)

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

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

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

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