Skip to content

click does not work in windows console #744

Closed

Description

@jrxpert

Hi, I tried using your library but when I tried running under windows I got the following error:

Traceback (most recent call last):
File "test.py", line 12, in <module>
click.echo('Continue? [yn] ', nl=False)
File "xxx\Lib\site-packages\click\utils.py", line 217, in echo
file = _default_text_stdout()
File "xxx\Lib\site-packages\click\_compat.py", line 621, in func
rv = wrapper_func()
File "xxx\Lib\site-packages\click\_compat.py", line 385, in get_text_stdout
rv = _get_windows_console_stream(sys.stdout, encoding, errors)
File "xxx\Lib\site-packages\click\_winconsole.py", line 264, in _get_windows_console_stream
f = getattr(f, 'buffer')
AttributeError: 'TextTranscodingWrapper' object has no attribute 'buffer'

Activity

  1. added a commit that references this issue on Feb 27, 2017
    5701c40
  2. untitaker commented on Feb 27, 2017

    @untitaker
    Contributor

    Done, thanks!

  3. 2press commented on May 26, 2018

    @2press

    Similar error here @untitaker

    Traceback (most recent call last):
      File "D:\Code\GitHub\StarCraft-Casting-Tool\scctool\tasks\webapp.py", line 189, in run
        self.application.run(port=65010)
      File "c:\users\tasch\appdata\local\programs\python\python36-32\lib\site-packages\flask\app.py", line 938, in run
        cli.show_server_banner(self.env, self.debug, self.name, False)
      File "c:\users\tasch\appdata\local\programs\python\python36-32\lib\site-packages\flask\cli.py", line 629, in show_server_banner
        click.echo(message)
      File "c:\users\tasch\appdata\local\programs\python\python36-32\lib\site-packages\click\utils.py", line 217, in echo
        file = _default_text_stdout()
      File "c:\users\tasch\appdata\local\programs\python\python36-32\lib\site-packages\click\_compat.py", line 621, in func
        rv = wrapper_func()
      File "c:\users\tasch\appdata\local\programs\python\python36-32\lib\site-packages\click\_compat.py", line 385, in get_text_stdout
        rv = _get_windows_console_stream(sys.stdout, encoding, errors)
      File "c:\users\tasch\appdata\local\programs\python\python36-32\lib\site-packages\click\_winconsole.py", line 264, in _get_windows_console_stream
        f = getattr(f, 'buffer')
    AttributeError: 'FileWrapper' object has no attribute 'buffer'
    
  4. 2press commented on May 26, 2018

    @2press

    Fixed this by updating to the current master branch, but now I encounter this error:

      File "site-packages\click\_compat.py", line 105, in __getattr__
    AttributeError: 'NullWriter' object has no attribute 'closed'
    
  5. niuneo commented on Jun 15, 2018

    @niuneo

    I encounter this similar issue. Can you explain in detail how you fixed it? @2press

  6. niuneo commented on Jun 15, 2018

    @niuneo

    File "C:\Python36-32\workfiles\ch05\hello_flask.py", line 10, in <module> app.run() File "C:\Python36-32\lib\site-packages\flask\app.py", line 938, in run cli.show_server_banner(self.env, self.debug, self.name, False) File "C:\Python36-32\lib\site-packages\flask\cli.py", line 629, in show_server_banner click.echo(message) File "C:\Python36-32\lib\site-packages\click\utils.py", line 217, in echo file = _default_text_stdout() File "C:\Python36-32\lib\site-packages\click\_compat.py", line 621, in func rv = wrapper_func() File "C:\Python36-32\lib\site-packages\click\_compat.py", line 385, in get_text_stdout rv = _get_windows_console_stream(sys.stdout, encoding, errors) File "C:\Python36-32\lib\site-packages\click\_winconsole.py", line 261, in _get_windows_console_stream func = _stream_factories.get(f.fileno()) @2press Thanks a lot.

  7. added this to the 7.0 milestone on Sep 10, 2018
  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
  11. added
    windows
    on Aug 8, 2026
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