Skip to content

"IOError: [Errno 12] Not enough space" on Windows 7 and Python 2 #825

Closed

Description

@segevfiner

This is caused by click/_winconsole.py:268-272. It seems that switching the standard streams to binary mode reveals the underlying limit of the Windows console of limiting a single write to 64K (I think this limit was lifted in Windows 8). This affects print, sys.stdout.write and click.echo.

It seems that many libraries and Python itself limit a single write to 32767 bytes to workaround this. Python 3 for example: Python/fileutils.c:1244-1250. It doesn't seem like Python 2 has this hack though.

We will have to either:

  1. Don't set the streams to binary and read/write to dupped stream fds (and file objects) that are set to binary.
  2. Wrap the standard streams and workaround this.
  3. Submit a patch to Python 2 which I'm not sure will ever be accepted.
  4. Other?

To reproduce:

import sys
import click

click.echo("spam")

print('A' * 100000) # or
sys.stdout.write('A' * 100000) # or
click.echo('A' * 100000)

Windows 7 SP1 x64
Python: 2.7.10
Click: 6.7

Activity

  1. changed the title [-]IOError: [Errno 12] Not enough space on Windows 7 and Python 2[/-] [+]"IOError: [Errno 12] Not enough space" on Windows 7 and Python 2[/+] on Jul 10, 2017
  2. added 2 commits that reference this issue on Jul 12, 2017
    5599251
    7c1b409
  3. added a commit that references this issue on Dec 16, 2017
    f6d330d
  4. added a commit that references this issue on Feb 7, 2018
    7a5b8c8
  5. added
    windows
    on May 17, 2018
  6. added this to the 7.0 milestone on Sep 19, 2018
  7. added a commit that references this issue on Sep 23, 2018
    6c0d585
  8. added 2 commits that reference this issue on Oct 8, 2018
  9. added a commit that references this issue on Oct 29, 2018
  10. locked as resolved and limited conversation to collaborators on Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    windows

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions