1
1

More than 1 year has passed since last update.

Gauge Pythonでgauge run specsをするとTypeError: Descriptors cannot not be created directlyエラーが出る

Posted at

はじめに

初めてGauge Pythonを実行する機会があり、起動がうまくいかなかったのでまとめます

問題

PythonでGaugeを実行したところ以下のエラーが出ました

$ gauge run specs
Traceback (most recent call last):
File "/home/watanabejin/.gauge/plugins/python/0.3.17/start.py", line 11, in <module>
from getgauge import handlers, logger, processor
File "/home/watanabejin/workspace/test/.venv/lib/python3.10/site-packages/getgauge/handlers.py", line 4, in <module>
from getgauge import logger, processor
File "/home/watanabejin/workspace/test/.venv/lib/python3.10/site-packages/getgauge/processor.py", line 7, in <module>
from getgauge.executor import (create_execution_status_response,
File "/home/watanabejin/workspace/test/.venv/lib/python3.10/site-packages/getgauge/executor.py", line 7, in <module>
from getgauge.messages.messages_pb2 import ExecutionStatusResponse, Message
File "/home/watanabejin/workspace/test/.venv/lib/python3.10/site-packages/getgauge/messages/messages_pb2.py", line 6, in <module>
import getgauge.messages.spec_pb2 as spec__pb2
File "/home/watanabejin/workspace/test/.venv/lib/python3.10/site-packages/getgauge/messages/spec_pb2.py", line 34, in <module>
_descriptor.EnumValueDescriptor(
File "/home/watanabejin/workspace/test/.venv/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 796, 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
Error occurred while waiting for runner process to finish.
Error : exit status 1
Error ----------------------------------

[Gauge]
Failed to start gauge API: Error occurred while waiting for runner process to finish.
Error : exit status 1

Get Support ----------------------------
        Docs:          https://docs.gauge.org
        Bugs:          https://github.com/getgauge/gauge/issues
        Chat:          https://github.com/getgauge/gauge/discussions

Your Environment Information -----------
        linux, 1.4.3, f98dd40
        html-report (4.2.0), java (0.9.1), play-cdc (0.1.4), python (0.3.17), screenshot (0.1.0)

実行した環境のgauge python0.3.17です

解決方法

以下を実行したところうまく動くようになりました

$ pip install --upgrade protobuf
$ export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

google.protobuf.descriptor.EnumValueDescriptorの直接作成が試みられており、これは新しいprotobufのバージョンでは許可されていないことが原因みたいです

今回はvenv上でいんすとーるしました

おわりに

個人的にはGauge Javaよりもつまづくことなく実行できたのでよかったです

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1