Skip to content

Python throws IOError in some scripts in Windows Integrated Terminal #36630

Closed

Description

Running docker-compose commands fails when running from the integrated powershell terminal. Running same commands in the standalone powershell terminal works fine. Here's the failing message:

> docker-compose -f .\docker-compose.dev.yml pull

Pulling redis (redis:latest)...
latest: Pulling from library/redis
d13d02fa248d: Downloading [===>                                               ]  1.867MB/30.11MB
a1846f364e39: Download complete
dba901efed8c: Download complete
Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose\cli\main.py", line 68, in main
  File "compose\cli\main.py", line 121, in perform_command
  File "compose\cli\main.py", line 653, in pull
  File "compose\project.py", line 512, in pull
  File "compose\service.py", line 1031, in pull
  File "compose\progress_stream.py", line 44, in stream_output
  File "compose\progress_stream.py", line 63, in print_output_event
  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

This looks like another instance of this issue - that one was reported to the docker repo, but the reporter does note that this only happens in the VS Code integrated terminal.

Also, please note, that I didn't have this problem up until today when I've installed the Fall Creators Update to Windows.


  • VSCode Version: Code 1.17.2 (b813d12, 2017-10-16T13:59:46.104Z)
  • OS Version: Windows_NT x64 10.0.16299
  • Extensions:
Extension Author (truncated) Version
ng-template Ang 0.1.7
htmltagwrap bra 0.0.3
jshint dba 0.10.15
vscode-eslint dba 1.3.2
EditorConfig Edi 0.11.0
js-is-jsx eg2 0.0.1
tslint eg2 1.0.11
vscode-guid hea 1.2.0
path-autocomplete ion 1.6.1
vscode-github Kni 0.22.0
graphql-for-vscode kum 1.6.2
Angular-BeastCode Mik 5.0.8
HTMLHint mka 0.4.0
azure-account ms- 0.1.3
debugger-for-chrome msj 3.4.0
angular2-inline nat 0.0.17
createGUID nwa 0.0.2
vscode-docker Pet 0.0.20
ejs-language-support Qas 0.0.1
vscode-icons rob 7.15.0
stylelint shi 0.30.0
Align ste 0.2.0
jsx-snippets Twe 0.0.1
gitblame wad 2.2.0
twig wha 1.0.2
jinja who 0.0.8
change-case wma 1.0.0

(3 theme extensions excluded)


Steps to Reproduce:

Reproduces without extensions: Yes/No

Activity

  1. added
    terminal
    on Oct 20, 2017
  2. Tyriar commented on Oct 20, 2017

    @Tyriar
    Contributor

    Jacek Dargiel (@jacek-dargiel) are you using a python virtual environment?

  3. added
    info-needed
    windows
    on Oct 20, 2017
  4. jacek-dargiel commented on Oct 23, 2017

    @jacek-dargiel
    Author

    Not sure. How can I check? I do have python 2.7 installed locally.

  5. Ahryman40k commented on Oct 24, 2017

    @Ahryman40k

    Hi.
    It seems I have the same issue with docker and vscode since I installed fall creator 2 days ago.
    In my case I have python 2.7 installed and python extensions in vscode.

  6. TheWozMSN commented on Oct 24, 2017

    @TheWozMSN

    Docker --version and Docker-Machine --version works as expected. Only Docker-Compose --version is failing in my preliminary test. Hope this helps

  7. Tyriar commented on Oct 26, 2017

    @Tyriar
    Contributor

    Jacek Dargiel (@jacek-dargiel) you would probably know if you were using it 🙂

    Ahryman40k (@Ahryman40k) Doug Woznicki (@TheWozMSN) are you both on Windows?

  8. TheWozMSN commented on Oct 26, 2017

    @TheWozMSN
  9. Ahryman40k commented on Oct 26, 2017

    @Ahryman40k

    Daniel Imms (@Tyriar)
    I'm using Windows 10 Pro.

  10. jrock2004 commented on Oct 27, 2017

    @jrock2004

    Daniel Imms (@Tyriar) do I need to install python for docker compose to work in vscode? I got a brand new windows 10 installed running 1709 and I have the same issue

  11. TheWozMSN commented on Oct 27, 2017

    @TheWozMSN

    Further Comment. Docker-Compose works in a regular powershell command window. Not with Integrated Powershell

  12. 83 remaining items

  13. jayshrivastava commented on Mar 14, 2018

    @jayshrivastava

    I was having a similar problem (post patch I assume v. 1.18.0 of Docker Compose), so I came here. In case anyone else has the same issue, I'll leave this for reference.

    It was a longpaths issue for me due to Jenkins giving the project folder a unique code. I was able to complete my compose using powershell, but Jenkins gave my these errors:

    Traceback (most recent call last):
      File "docker-compose", line 6, in <module>
      File "compose\cli\main.py", line 71, in main
      File "compose\cli\main.py", line 124, in perform_command
      File "compose\cli\main.py", line 959, in up
      File "compose\project.py", line 452, in up
      File "compose\service.py", line 308, in ensure_image_exists
      File "compose\service.py", line 967, in build
      File "site-packages\docker\api\build.py", line 150, in build
      File "site-packages\docker\utils\build.py", line 14, in tar
      File "site-packages\docker\utils\utils.py", line 100, in create_archive
      File "tarfile.py", line 1881, in gettarinfo
    **WindowsError: [Error 3] The system cannot find the path specified:** u'C:\\Program Files 
    (x86)\\Jenkins\\workspace\\repo-name-7F4KYNQD36XGPFD43T2E7OJE3M35TAB44IFL6IX324UGUB4NSC2A@2\\www\\administrator\\components\\com_jfilemanager\\assets\\files\\adsfdfadsf
    adsfdasf\\asdfasfdasfdaf\\asdfasdfasf.JPG'
    

    Basically, my copy of the www folder in my compose file failed because the path was too long. I had to enable long paths on the windows server I had docker and jenkins installed on.

      www:
            build: .
            ports:
                - "8001:80"
            volumes:
                **- ./www:/var/www/html/**
            links:
                - db
            networks:
                - default
    

    All I had to do was follow this:
    https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/

  14. bapcyk commented on Mar 18, 2018

    @bapcyk

    I have the same problems but this is not related to:

    • Windows (I run the same command in powershell.exe/cmd.exe out of Visual Studio Code many times and never get this error)
    • long paths (path is short, less 32 chars)
    • virtual env (I don't use virtual environment)
    • docker (I don't use docker)

    And this bug happens very often, for example, several times in a row

  15. ronaldgreeff commented on Mar 22, 2018

    @ronaldgreeff

    I have the same error and all I'm doing is running python code with no modules (also no virtualenv)
    If I sequentially "run python file in terminal", the error references random lines each time (line 15, line 25, line 34) and then works, then throws the error again.

    Windows 10, Python 2.7.14

    EDIT: I posted this comment before finding this - https://www.bountysource.com/issues/52206767-random-io-errors-on-windows-10-0-16299-64. Apparently it's a bug in Win 10.

  16. Wosi commented on Mar 25, 2018

    @Wosi

    I was facing the same issues in November 2017 with the Fall Creators Update. I was able to delay this update until today. Now I'm unable to work with VSCode since all my compile and test scripts don't work anymore. I probably have to look for a different editor while this issue is open ;-(

    I really beg you to fix this issue as soon as possible! I really don't want to abandon my beloved VSCode.

    My original issue was this: #38068

  17. jongio commented on Mar 25, 2018

    @jongio

    I think it has something to do with print function - I was able to get around it by wrapping my print calls in a try block and then using print() in the except block, like this:

    // Using python click

        def echo(self, text, color="", dim=False):
            try:
                click.secho(text, fg=color, dim=dim)
            except:
                print (text)
    

    I've also had luck putting the futures print at the top of my python script:

    from __future__ import print_function

  18. NicolasDorier commented on Mar 28, 2018

    @NicolasDorier

    Same issue here. Same command work in a separate powershell, not in the integrated terminal.

  19. raokrutarth commented on Apr 3, 2018

    @raokrutarth

    The issue is still not resolved. Please take a look. Steps:
    recursive function with print statements. executes some of the statements and then randomly IOError: [Errno 0] Error

    Version 1.21.1
    Commit 79b44aa
    Date 2018-03-14T14:47:13.351Z
    Shell 1.7.9
    Renderer 58.0.3029.110
    Node 7.9.0
    Architecture ia32

  20. Tyriar commented on Apr 4, 2018

    @Tyriar
    Contributor

    raokrutarth (@raokrutarth) it's an issue in Windows which takes a while to roll out.

  21. Wosi commented on Apr 6, 2018

    @Wosi

    Daniel Imms (@Tyriar) Is there a fix on the way? How can I get it earlier?

  22. Tyriar commented on Apr 6, 2018

    @Tyriar
    Contributor

    Christopher Wosinski (@Wosi) it's fixed in the Windows Insiders channel #36630 (comment), you might not want to commit to that just to fix this though. It should be coming in the upcoming Spring release of Windows w

  23. Box-Of-Hats commented on Apr 17, 2018

    @Box-Of-Hats

    Appears to be fixed in the latest Windows 10 Spring Creators Update

  24. dllerena commented on May 1, 2018

    @dllerena

    Jake (@Box-Of-Hats) It was fixed on Windows 1803!! I installed it and tested it!! YAY!!!

  25. Tyriar commented on May 1, 2018

    @Tyriar
    Contributor

    🎉 Closing this off as people are confirming it's fixed! If you're experiencing this problem make sure you have installed the Windows 10 April Update (1803).

  26. locked as resolved and limited conversation to collaborators on May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugterminalupstreamwindows

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions