Skip to content
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

Broken on Windows: Need to use shutil.get_terminal_size() #13

Open
DevOptimusPrime opened this issue Jul 13, 2016 · 8 comments
Open

Broken on Windows: Need to use shutil.get_terminal_size() #13

DevOptimusPrime opened this issue Jul 13, 2016 · 8 comments

Comments

@DevOptimusPrime
Copy link

Trying to the the simple examples working but the
from fabulous.color import bold

statement fails with
>>> from fabulous.color import bold Traceback (most recent call last): File "<stdin>", line 1, in <module> File "D:\Python35\lib\site-packages\fabulous\color.py", line 31, in <module> from fabulous import utils, xterm256, grapefruit File "D:\Python35\lib\site-packages\fabulous\utils.py", line 25, in <module> import fcntl ImportError: No module named 'fcntl'

@jart
Copy link
Owner

jart commented Jul 13, 2016

How could that be? This is a standard module in both Python 2 and 3.

@DevOptimusPrime
Copy link
Author

My guess, but I am no expert, is that since it's Unix specific it only gets installed on Unix environments?

My Python 3.5 installation on Windows 7 does not contain a fcntl library, only some tests in the lib\test directory called test_fcntl_cpython.....

@jart
Copy link
Owner

jart commented Jul 13, 2016

Ohhh. Then this is something we definitely need to fix. It seems the way to do this, is to update the dimensions method in util.py to use this library: https://pypi.python.org/pypi/backports.shutil_get_terminal_size as I learned from http://stackoverflow.com/a/14422538

Would you like to contribute this as a pull request, since you actually use windows?

@DevOptimusPrime
Copy link
Author

I'm a pretty green python dev - I'd be in over my head most likely (please forgive lol). I'd gladly test it though.

@jart jart added the bug label Jul 13, 2016
@jart jart changed the title Code samples fail on Windows during Import with No Module named fcntl Broken on Windows: Need to use shutil.get_terminal_size() Jul 13, 2016
@jart
Copy link
Owner

jart commented Jul 13, 2016

If I get bored one of these weekends, I'll consider writing it. But I'm hesitant to do so, because I have no Windows computer to test further. For all I know, other functionality might be broken too. Hopefully another volunteer will come along to implement the Windows support.

@willtheorangeguy
Copy link

I can test it, since I have a Windows computer (Windows 10 to be precise).
But I don't think I will be able to write it. I might be able to make some slight changes though.
I'll try when I have time.

MinchinWeb added a commit to MinchinWeb/fabulous that referenced this issue Sep 16, 2016
Also changed default console size to (80, 24);
Fixes jart#13
@MinchinWeb
Copy link

@jart: check out my implementation!

It replies on shutil.get_terminal_size, which was added to the standard library for Python 3.3. Failing that it fallsover to a backported version of the same (added to the setup.py requirements section conditionally).

It also changes the default terminal size to (80,24), which seems to be a much more common default.

Tested and works on Windows!

@willtheorangeguy
Copy link

willtheorangeguy commented Oct 31, 2016

Thanks for working on this!
I'll take a look at it!

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

No branches or pull requests

4 participants