psobot / keynote-parser

A packer/unpacker for Apple Keynote presentation files.
156 stars 17 forks source link

TypeError: Descriptors cannot not be created directly, again #43

Closed matti closed 1 year ago

matti commented 1 year ago

looks similar to https://github.com/psobot/keynote-parser/issues/38, but now with 1.12.1.0

$ pip3 install keynote-parser
Requirement already satisfied: keynote-parser in /Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages (1.12.1.0)
Requirement already satisfied: PyYAML>=5.3.1 in /Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages (from keynote-parser) (6.0)
Requirement already satisfied: python-snappy>=0.5.3 in /Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages (from keynote-parser) (0.6.1)
Requirement already satisfied: future>=0.17.1 in /Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages (from keynote-parser) (0.18.2)
Requirement already satisfied: tqdm>=4.14.0 in /Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages (from keynote-parser) (4.64.1)
Requirement already satisfied: colorama>=0.4.3 in /Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages (from keynote-parser) (0.4.5)
Requirement already satisfied: protobuf>=3.13.0 in /Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages (from keynote-parser) (4.21.9)
Requirement already satisfied: Pillow>=7.1.0 in /Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages (from keynote-parser) (9.3.0)
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the '/Users/matti/.asdf/installs/python/3.10.4/bin/python3.10 -m pip install --upgrade pip' command.
$ keynote-parser
Traceback (most recent call last):
  File "/Users/matti/.asdf/installs/python/3.10.4/bin//keynote-parser", line 5, in <module>
    from keynote_parser.command_line import main
  File "/Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/keynote_parser/command_line.py", line 12, in <module>
    from .file_utils import process
  File "/Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/keynote_parser/file_utils.py", line 22, in <module>
    from .codec import IWAFile
  File "/Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/keynote_parser/codec.py", line 15, in <module>
    from .mapping import NAME_CLASS_MAP, ID_NAME_MAP
  File "/Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/keynote_parser/mapping.py", line 3, in <module>
    from .generated import KNArchives_pb2 as KNArchives
  File "/Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/keynote_parser/generated/KNArchives_pb2.py", line 16, in <module>
    from . import TSPMessages_pb2 as TSPMessages__pb2
  File "/Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/keynote_parser/generated/TSPMessages_pb2.py", line 32, in <module>
    _descriptor.EnumValueDescriptor(
  File "/Users/matti/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 755, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
psobot commented 1 year ago

Thanks @matti! This has been fixed in v1.12.1.2, now released on PyPI.