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

--format=json broken with prettytable #119

Closed
adwhitMSM opened this issue Dec 20, 2021 · 3 comments
Closed

--format=json broken with prettytable #119

adwhitMSM opened this issue Dec 20, 2021 · 3 comments

Comments

@adwhitMSM
Copy link

adwhitMSM commented Dec 20, 2021

Hi,

I was using this tool sucessfully until I added prettytable to my project (for other uses), then it broke. It seems that previously it was using the Ptable 'fallback' but once prettytable was installed it preferentially used that, and errored.

pip-licenses V3.5.3
prettytable V2.5.0
poetry V1.1.8
Python V3.9

Traceback

➜ poetry run pip-licenses --format=json
Traceback (most recent call last):
  File "/Users/me/Library/Caches/pypoetry/virtualenvs/project-fJIZ19Z2-py3.9/bin/pip-licenses", line 8, in <module>
    sys.exit(main())
  File "/Users/me/Library/Caches/pypoetry/virtualenvs/project-fJIZ19Z2-py3.9/lib/python3.9/site-packages/piplicenses.py", line 893, in main
    output_string = create_output_string(args)
  File "/Users/me/Library/Caches/pypoetry/virtualenvs/project-fJIZ19Z2-py3.9/lib/python3.9/site-packages/piplicenses.py", line 558, in create_output_string
    return table.get_string(fields=output_fields, sortby=sortby)
  File "/Users/me/Library/Caches/pypoetry/virtualenvs/project-fJIZ19Z2-py3.9/lib/python3.9/site-packages/piplicenses.py", line 349, in get_string
    formatted_rows = self._format_rows(rows, options)
TypeError: _format_rows() takes 2 positional arguments but 3 were given
@raimon49
Copy link
Owner

@adwhitMSM Thanks for the detailed bug report.

I have seen the same error in my environment. To resolve this, I need to follow up on the prettytable#138 changes, but I don't have the time to do that right now.

If you can pinning the version of prettytable to 2.2.1 or lower in your poetry environment, this problem can be avoided.

@adwhitMSM
Copy link
Author

Thanks, pinning the version worked

raimon49 added a commit that referenced this issue Oct 27, 2022
* Complete migration of table output library from PTable to prettytable
* Remove compatibility to work with either PTable or prettytable
* Fix failing tests with prettytable #120
@raimon49
Copy link
Owner

raimon49 commented Nov 6, 2022

This issue has been resolved in pip-licenses 4.x
https://pypi.org/project/pip-licenses/4.0.0/

@raimon49 raimon49 closed this as completed Nov 6, 2022
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