Poetry: Value Error on any poetry command invocation in Travis CI

Created on 10 Jan 2020  路  2Comments  路  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Travis CI Python 3.7 environment (Ubuntu 16.04.5 LTS)
  • Poetry version: 1.0.1
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

After installing poetry during the build every poetry command fails. See the output below.

$ python --version
Python 3.7.1
$ pip --version
pip 18.1 from /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/pip (python 3.7)
install.1
3.27s$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
$HOME/.poetry/bin
This path will then be added to your `PATH` environment variable by
modifying the profile files located at:
$HOME/.profile
$HOME/.bash_profile
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing version: 1.0.1
  - Downloading poetry-1.0.1-linux.tar.gz (27.78MB)
Poetry (1.0.1) is installed now. Great!
To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.
To configure your current shell run `source $HOME/.poetry/env`
install.2
0.01s$ source $HOME/.poetry/env
1.29s$ poetry --version -vvv
[ValueError]
invalid width -1 (must be > 0)
Traceback (most recent call last):
  File "/home/travis/.poetry/lib/poetry/_vendor/py3.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/home/travis/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/home/travis/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 163, in _do_handle
    self._dispatcher.dispatch(PRE_HANDLE, event)
  File "/home/travis/.poetry/lib/poetry/_vendor/py3.7/clikit/api/event/event_dispatcher.py", line 22, in dispatch
    self._do_dispatch(listeners, event_name, event)
  File "/home/travis/.poetry/lib/poetry/_vendor/py3.7/clikit/api/event/event_dispatcher.py", line 89, in _do_dispatch
    listener(event, event_name, self)
  File "/home/travis/.poetry/lib/poetry/_vendor/py3.7/clikit/config/default_application_config.py", line 160, in print_version
    version.render(event.io)
  File "/home/travis/.poetry/lib/poetry/_vendor/py3.7/clikit/ui/components/name_version.py", line 28, in render
    paragraph.render(io, indentation)
  File "/home/travis/.poetry/lib/poetry/_vendor/py3.7/clikit/ui/components/paragraph.py", line 25, in render
    '
'".join(textwrap.wrap(self._text, text_width)),
  File "m/opt/python/3.7.1/lib/python3.7/textwrap.py", line 379, in wrap
    return w.wrap(text)
  File "/opt/python/3.7.1/lib/python3.7/textwrap.py", line 354, in wrap
    return self._wrap_chunks(chunks)
  File "/opt/python/3.7.1/lib/python3.7/textwrap.py", line 248, in _wrap_chunks
    raise ValueError('invalid width %r (must be > 0)' % self.width)
The command "poetry --version -vvv" failed and exited with 1 during .
Your build has been stopped.
Bug

Most helpful comment

Strange. Nothing has changed in CliKit between Poetry 1.0.0 and Poetry 1.0.1.

From what I can tell, the error is caused by CliKit seeing the terminal width as 0 causing the issue of the negative width in textwrap. This is not on Poetry's end, nor does it seem to be on CliKit's ends (a terminal width of 0 is obviously wrong).

You might want to try to set the LINES and COLUMNS environment variables to check if it solves the issue.

```bash
export COLUMNS=80
export LINES=20

All 2 comments

Strange. Nothing has changed in CliKit between Poetry 1.0.0 and Poetry 1.0.1.

From what I can tell, the error is caused by CliKit seeing the terminal width as 0 causing the issue of the negative width in textwrap. This is not on Poetry's end, nor does it seem to be on CliKit's ends (a terminal width of 0 is obviously wrong).

You might want to try to set the LINES and COLUMNS environment variables to check if it solves the issue.

```bash
export COLUMNS=80
export LINES=20

@sdispater That fixed the issue. Thanks!

The build ran on an internal Travis instance.Therefore I am not sure if it is only an issue there.

Nothing has changed in CliKit between Poetry 1.0.0 and Poetry 1.0.1.

The issue appeared after switching to 1.0.0.

Was this page helpful?
0 / 5 - 0 ratings