question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem parsing multiline licenses with the pip show parser

See original GitHub issue

Hi, Thanks for the great work on jc.

We’ve come across a few packages with multiline license which fail in the pip show parser for jc

pip show cppy | jc --pip-show -dd
IndexError
Python 3.7.7: /usr/home/bryder/bin/jc.exe
Mon May 16 14:51:08 2022

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /usr/home/bryder/<string> in <module>()


 /usr/home/bryder/jc.cli in main()


 /usr/home/bryder/jc.parsers.pip_show in parse(data='Name: cppy\nVersion: 1.2.1\nSummary: UNKNOWN\nHome-...python3.7/site-packages\nRequires: \nRequired-by: \n', raw=False, quiet=False)

IndexError: list index out of range
    __cause__ = None
    __class__ = <class 'IndexError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of IndexError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of IndexError object>
    __doc__ = 'Sequence index out of range.'
    __eq__ = <method-wrapper '__eq__' of IndexError object>
    __format__ = <built-in method __format__ of IndexError object>
    __ge__ = <method-wrapper '__ge__' of IndexError object>
    __getattribute__ = <method-wrapper '__getattribute__' of IndexError object>
    __gt__ = <method-wrapper '__gt__' of IndexError object>
    __hash__ = <method-wrapper '__hash__' of IndexError object>
    __init__ = <method-wrapper '__init__' of IndexError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of IndexError object>
    __lt__ = <method-wrapper '__lt__' of IndexError object>
    __ne__ = <method-wrapper '__ne__' of IndexError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of IndexError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of IndexError object>
    __repr__ = <method-wrapper '__repr__' of IndexError object>
    __setattr__ = <method-wrapper '__setattr__' of IndexError object>
    __setstate__ = <built-in method __setstate__ of IndexError object>
    __sizeof__ = <built-in method __sizeof__ of IndexError object>
    __str__ = <method-wrapper '__str__' of IndexError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ('list index out of range',)
    with_traceback = <built-in method with_traceback of IndexError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "jc.cli", line 457, in main
    result = parser.parse(data, raw=raw, quiet=quiet)
  File "jc.parsers.pip_show", line 131, in parse
    item_value = row.split(': ', maxsplit=1)[1]
IndexError: list index out of range

The same problem occurs with kiwisolver

It appears to be because they have a multiline license

pip show cppy
Name: cppy
Version: 1.2.1
Summary: UNKNOWN
Home-page: https://github.com/nucleic/cppy
Author: None
Author-email: The Nucleic Development Team <sccolbert@gmail.com>
License: Copyright (c) 2014, Nucleic
        All rights reserved.        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:        
        * Redistributions of source code must retain the above copyright notice, this
          list of conditions and the following disclaimer.        
        * Redistributions in binary form must reproduce the above copyright notice,
          this list of conditions and the following disclaimer in the documentation
          and/or other materials provided with the distribution.        
        * Neither the name of the copyright holder nor the names of its
          contributors may be used to endorse or promote products derived from
          this software without specific prior written permission.        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.        
Location: /usr/home/bryder/.local/lib/python3.7/site-packages
Requires: 
Required-by: 

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kellyjonbrazilcommented, May 31, 2022

Fix is in v1.20.0

1reaction
brydercommented, May 16, 2022

Definitely keep the full license please using \n for line breaks.

I’m used that that kind of thing in json for multiline strings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

parse a multiline text with pyparsing - Stack Overflow
I'm getting in trouble with using the pyparsing module over several lines (the real problem is much more complex than this simple example)....
Read more >
kellyjonbrazil/jc - GitHub
Argument Command or Filetype Documentation ‑‑acpi acpi command parser details ‑‑airport airport ‑I command parser details ‑‑airport‑s airport ‑s command parser details
Read more >
pep8 - PyPI
pep8 is a tool to check your Python code against some of the style conventions in PEP 8. Features. Plugin architecture: Adding new...
Read more >
How to Parse Multiline Log Messages With the Infrastructure ...
Learn how to use custom Fluent Bit configurations on Linux and Windows to support multiline log messages in New Relic Logs.
Read more >
Welcome to Pytest-BDD's documentation! — Pytest-BDD 6.1.1 ...
Parse multiline steps according to the gherkin specification #365. 3.3.0¶. Drop support for pytest < 4.3. Fix a Python 4.0 bug. Fix pytest ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found