bskinn / sphobjinv

Toolkit for manipulation and inspection of Sphinx objects.inv files
https://sphobjinv.readthedocs.io
MIT License
78 stars 9 forks source link

Fails to open 3.10 cpython objects inventory #208

Closed gaborbernat closed 2 years ago

gaborbernat commented 2 years ago
curl -s https://docs.python.org/3.9/objects.inv 1>out.inv

sphobjinv suggest ./out.inv Type

Traceback (most recent call last):
  File "/Users/bgabor8/.local/bin/sphobjinv", line 8, in <module>
    sys.exit(main())
  File "/Users/bgabor8/.local/pipx/venvs/sphobjinv/lib/python3.10/site-packages/sphobjinv/cli/core.py", line 208, in main
    inv, in_path = inv_local(params)
  File "/Users/bgabor8/.local/pipx/venvs/sphobjinv/lib/python3.10/site-packages/sphobjinv/cli/load.py", line 115, in inv_local
    inv = import_infile(in_path)
  File "/Users/bgabor8/.local/pipx/venvs/sphobjinv/lib/python3.10/site-packages/sphobjinv/cli/load.py", line 64, in import_infile
    inv = Inventory(in_path)
  File "<attrs generated init sphobjinv.inventory.Inventory>", line 16, in __init__
  File "/Users/bgabor8/.local/pipx/venvs/sphobjinv/lib/python3.10/site-packages/sphobjinv/inventory.py", line 350, in __attrs_post_init__
    self._general_import()
  File "/Users/bgabor8/.local/pipx/venvs/sphobjinv/lib/python3.10/site-packages/sphobjinv/inventory.py", line 594, in _general_import
    raise TypeError("Invalid Inventory source type")
TypeError: Invalid Inventory source type
bskinn commented 2 years ago

First guess is an encoding problem with curl ... > out.inv.

What happens if you wget the inventory, instead?

Or, try sphobjinv suggest -u {URL} Type.

bskinn commented 2 years ago

Alternatively, if you really need to use curl, try:

$ curl {URL} | sphobjinv suggest - Type
gaborbernat commented 2 years ago

You're right; though not sure why it works with 3.9 and not for 3.10 😊

bskinn commented 2 years ago

Ah, no, that last curl will fail...it only works with decompressed inventories.

The shell does not play nice with piped binary data...I don't know exactly how it transforms it, but it is definitely NOT a no-op. (Or, at least, it's not guaranteed to always be no-op.)

I expect that there are Obscure Zlib/Shell Reasons(TM) why 3.9's piped okay but 3.10's didn't.