Skip to content

Use colorama to get console width on Win32 #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

stephenrauch
Copy link

No description provided.

@stephenrauch
Copy link
Author

The failed build worked on my fork: https://github.com/stephenrauch/py/branches

@RonnyPfannschmidt
Copy link
Member

flaky test, a rerun worked 👍

please rebase

import termios,fcntl,struct
call = fcntl.ioctl(1,termios.TIOCGWINSZ,"\000"*8)
height,width = struct.unpack( "hhhh", call ) [:2]
if colorama is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this platform check is incorrect, as colorama might be installed on non-windows environments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just noted that the same code is down below
so this is basically bad code duplication (see the win32 object handling)

Copy link
Author

@stephenrauch stephenrauch Aug 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up near the top of the file is:

colorama = None
if sys.platform == "win32":
    try:
        import colorama

colorama will be None in non-windows environments since the import will not be attempted.

@stephenrauch stephenrauch force-pushed the win32-width-from-colorama branch from 67a47fa to bc63caf Compare August 28, 2018 05:54
@nicoddemus
Copy link
Member

I think we can close this in favor of #201.

@blueyed
Copy link
Contributor

blueyed commented Feb 13, 2019

@nicoddemus
sounds good, please close (I cannot).

@nicoddemus
Copy link
Member

@blueyed also added you as collaborator here. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants