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

Error when window size < table size #1

Closed
Ben-Baert opened this issue May 16, 2016 · 4 comments
Closed

Error when window size < table size #1

Ben-Baert opened this issue May 16, 2016 · 4 comments

Comments

@Ben-Baert
Copy link
Contributor

If the window size is smaller than the table size, I get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/habito", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/habito/habito.py", line 111, in list
    r[0] = '\n'.join(wrap(r[0], max_col_width))
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/textwrap.py", line 380, in wrap
    return w.wrap(text)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/textwrap.py", line 355, in wrap
    return self._wrap_chunks(chunks)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/textwrap.py", line 249, in _wrap_chunks
    raise ValueError("invalid width %r (must be > 0)" % self.width)
ValueError: invalid width -27 (must be > 0)

It would be nice to have a cleaner error message or a dynamic table (e.g. pick nr of days depending on width).

@Ben-Baert
Copy link
Contributor Author

It looks like this was dealt with in the last commit, but that the commit wasn't pushed to Pypi yet. Is this correct?

@codito
Copy link
Owner

codito commented May 17, 2016

Pushed 1.0a2 to pypi. Let me know if it fixes this issue. Thanks for the report.

@Ben-Baert
Copy link
Contributor Author

Hi, thanks for the quick reply! I just filed a pull request #2 that deals with the issue by adapting the table width to the terminal width. Let me know whether it meets your expectations and if not, what needs to be improved.

@codito
Copy link
Owner

codito commented May 18, 2016

Fixed with 295073c

@codito codito closed this as completed May 18, 2016
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

No branches or pull requests

2 participants