package resolution fails with TypeError: '<' not supported between instances of 'str' and 'NoneType'
python-inspector --python-version 313 --operating-system linux --json-pdt python-inspector.json --requirement requirements.txt --verbose
returns the following error message:
retrieve package data from pypi: retrieved package 'pkg:pypi/[email protected]' retrieved package 'pkg:pypi/[email protected]' retrieved package 'pkg:pypi/[email protected]' retrieved package 'pkg:pypi/[email protected]' retrieved package 'pkg:pypi/[email protected]' retrieved package 'pkg:pypi/[email protected]' retrieved package 'pkg:pypi/[email protected]' retrieved package 'pkg:pypi/[email protected]' Traceback (most recent call last): File "/home/scheer/.local/lib/python3.12/site-packages/python_inspector/resolve_cli.py", line 259, in resolve_dependencies resolution_result: Dict = resolver_api( ^^^^^^^^^^^^^ File "/home/scheer/.local/lib/python3.12/site-packages/python_inspector/api.py", line 312, in resolve_dependencies packages = [pkg.to_dict() for pkg in asyncio.run(gather_pypi_data()) if pkg is not None] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/home/scheer/.local/lib/python3.12/site-packages/python_inspector/api.py", line 310, in gather_pypi_data return await asyncio.gather(*[get_pypi_data(package) for package in purls]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/scheer/.local/lib/python3.12/site-packages/python_inspector/api.py", line 298, in get_pypi_data data = await get_pypi_data_from_purl( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/scheer/.local/lib/python3.12/site-packages/python_inspector/package_data.py", line 82, in get_pypi_data_from_purl wheel_url = choose_single_wheel(wheel_urls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/scheer/.local/lib/python3.12/site-packages/python_inspector/package_data.py", line 128, in choose_single_wheel wheel_urls.sort(reverse=True) TypeError: '<' not supported between instances of 'str' and 'NoneType'
I found a very simple solution which works at least at my requirements.txt. The reason for the error is a none return value from wheel_urls, means no wheel for the retrieved package could be found.
package_data.py:
wheels_urls.sort expects a string and fails on none.
so the fix is a add a new command the line BEFORE wheel_urls.sort(reverse=True) to skip the none value:
wheel_urls = [url for url in wheel_urls if url is not None]
Could somebody please retribute this change to the project.
Hey @thomasscheer, thanks for catching this. Can you please do the above changes in a PR ?
@TG1999 Currently I'm not allowed to push my branch to the repository of python-inspector. So I can't create a PR.
Hey, @thomasscheer you can make a fork, and create a PR from the fork