Skip to content
This repository was archived by the owner on Mar 15, 2025. It is now read-only.
This repository was archived by the owner on Mar 15, 2025. It is now read-only.

audit_log_pb2.py no longer up to date with google cloud logging 3.1.1 / protobuf 4.21.0 #54

@vitas-pm

Description

@vitas-pm

As of google cloud logging version 3.1.1 with protobuf 4.21.0 any attempts of using google cloud logging result in the following error message:

  File "/usr/local/lib/python3.8/site-packages/google/cloud/logging/__init__.py", line 18, in <module>
    from google.cloud.logging_v2 import __version__
  File "/usr/local/lib/python3.8/site-packages/google/cloud/logging_v2/__init__.py", line 25, in <module>
    from google.cloud.logging_v2.client import Client
  File "/usr/local/lib/python3.8/site-packages/google/cloud/logging_v2/client.py", line 25, in <module>
    from google.cloud.logging_v2._helpers import _add_defaults_to_filter
  File "/usr/local/lib/python3.8/site-packages/google/cloud/logging_v2/_helpers.py", line 25, in <module>
    from google.cloud.logging_v2.entries import LogEntry
  File "/usr/local/lib/python3.8/site-packages/google/cloud/logging_v2/entries.py", line 31, in <module>
    import google.cloud.audit.audit_log_pb2  # noqa: F401
  File "/usr/local/lib/python3.8/site-packages/google/cloud/audit/audit_log_pb2.py", line 62, in <module>
    _descriptor.FieldDescriptor(
  File "/usr/local/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 560, 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

I am using google-cloud-audit-log==0.2.0 on python 3.8.
The problem can be replicated by installing the newest versions of google-cloud-logging and protobuf and running
import google.cloud.logging

I suppose audit_log_pb2.py just needs to be created with a newer version of protoc to resolve this issue.

Metadata

Metadata

Assignees

Labels

needs more infoThis issue needs more information from the customer to proceed.type: questionRequest for information or clarification. Not an issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions