Как исправить ошибку «.proto» | Файлы «_pb2.py»

При запуске main.pyвозникает следующая ошибка... pip freeze Python 3.11.5 protobuf==4.25.1

Сгенерировал .proto файл protoc --python-out=. proto_file.proto. Сгенерированный файл (содержимое) прикреплю внизу ошибки... его содержимое немного сокращено, чтобы не занимать много места.

Я пытался pip install --no-binary=protobuf protobuf. Но это дало мне ошибку. Если это проблема. Я добавлю дополнительную информацию.

ERROR:

Traceback (most recent call last):
  File "D:\Projects\Project_1\main.py", line 5, in <module>
    from mymodule_1.client import ClassClient
  File "D:\Projects\Project_1\mymodule_1\client.py", line 14, in <module>
    from mymodule_1.features import FeatureBase
  File "D:\Projects\Project_1\mymodule_1\features\__init__.py", line 5, in <module>
    from mymodule_1.features.sharedobjects import SOBase
  File "D:\Projects\Project_1\mymodule_1\features\sharedobjects.py", line 39, in <module>
    from mymodule_1.protobufs import proto_file_pb2 as proto_file_pb2
  File "D:\Projects\Project_1\mymodule_1\protobufs\proto_file_pb2.py", line 15, in <module>
    from mymodule_1.protobufs import proto_file_2_pb2 as proto_file_2_pb2
  File "D:\Projects\Project_1\mymodule_1\protobufs\proto_file_pb2.py", line 18, in <module>
    DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\proto_file_pb2.proto\x1a google/protobuf/descriptor.proto\"\xf1\x02\n\x12\x43MsgProtoBufHeader\x12\x17\n\x0f\x63lient_steam_id\x18\x01 \x01(\x06\x12\x19\n\x11\x63lient_session_id\x18\x02 \x01(\x05\x12\x15\n\rsource_app_id\x18\x03 \x01(\r\x12+\n\rjob_id_source\x18\n \x01(\x06:\x14\x31\x38\x34\x34\x36\x37\x34\x34\x30\x37\x33\x37\x30\x39\x35\x35\x31\x36\x31\x35\x12+\n\rjob_id_target\x18\x0b \x01(\x06:\x14\x31\x38\x34\x34\x36\x37\x34\x34\x30\x37\x33\x37\x30\x39\x35\x35\x31\x36\x31\x35\x12\x17\n\x0ftarget_job_name\x18\x0c \x01(\t\x12\x12\n\x07\x65result\x18\r \x01(\x05:\x01\x32\x12\x15\n\rerror_message\x18\x0e \x01(\t\x12\x44\n\ngc_msg_src\x18\xc8\x01 \x01(\x0e\x32\x11.GCProtoBufMsgSrc:\x1cGCProtoBufMsgSrc_Unspecified\x12 \n\x13gc_dir_index_source\x18\xc9\x01 \x01(\x05:\x02-1:\n\x80\xa6\x1d\x80\x02\x88\xa6\x1d\x80\x08\"L\n\x1e\x43GCSystemMsg_GetAccountDetails\x12\x0f\n\x07steamid\x18\x01 \x01(\x06\x12\r\n\x05\x61ppid\x18\x02 \x01(\r:\n\x80\xa6\x1d\x80\x01\x88\xa6\x1d\x80\x04\"\x8c\x08\n\'CGCSystemMsg_GetAccountDetails_Response\x12\x1d\n\x12\x65result_deprecated\x18\x01 \x01(\r:\x01\x32\x12\x14\n\x0c\x61\x63\x63ount_name\x18\x02 \x01(\t\x12\x14\n\x0cpersona_name\x18\x03 \x01(\t\x12\x1a\n\x12is_profile_created\x18\x1a \x01(\x08\x12\x19\n\x11is_profile_public\x18\x04 \x01(\x08\x12\x1b\n\x13is_inventory_public\x18\x05 \x01(\x08\x12\x15\n\ris_vac_banned\x18\x07 \x01(\x08\x12\x15\n\ris_cyber_cafe\x18\x08 \x01(\x08\x12\x19\n\x11is_school_account\x18\t \x01(\x08\x12\x12\n\nis_limited\x18\n \x01(\x08\x12\x15\n\ris_subscribed\x18\x0b \x01(\x08\x12\x0f\n\x07package\x18\x0c \x01(\r\x12\x1d\n\x15is_free_trial_account\x18\r \x01(\x08\x12\x1d\n\x15\x66ree_trial_expiration\x18\x0e \x01(\r\x12\x17\n\x0fis_low_violence\x18\x0f \x01(\x08\x12\x1e\n\x16is_account_locked_down\x18\x10 \x01(\x08\x12\x1b\n\x13is_community_banned\x18\x11 \x01(\x08\x12\x17\n\x0fis_trade_banned\x18\x12 \x01(\x08\x12\x1c\n\x14trade_ban_expiration\x18\x13 \x01(\r\x12\x11\n\taccountid\x18\x14 \x01(\r\x12\x1b\n\x13suspension_end_time\x18\x15 \x01(\r\x12\x10\n\x08\x63urrency\x18\x16 \x01(\t\x12\x13\n\x0bsteam_level\x18\x17 \x01(\r\x12\x14\n\x0c\x66riend_count\x18\x18 \x01(\r\x12\x1d\n\x15\x61\x63\x63ount_creation_time\x18\x19 \x01(\r\x12\x1d\n\x15is_steamguard_enabled\x18\x1b \x01(\x08\x12\x19\n\x11is_phone_verified\x18\x1c \x01(\x08\x12\"\n\x1ais_two_factor_auth_enabled\x18\x1d \x01(\x08\x12\x1f\n\x17two_factor_enabled_time\x18\x1e \x01(\r\x12\x1f\n\x17phone_verification_time\x18\x1f \x01(\r\x12\x10\n\x08phone_id\x18! \x01(\x04\x12\x1c\n\x14is_phone_identifying\x18\" \x01(\x08\x12\x1a\n\x12rt_identity_linked\x18# \x01(\r\x12\x15\n\rrt_birth_date\x18$ \x01(\r\x12\x18\n\x10txn_country_code\x18% \x01(\t\x12\x1e\n\x16has_accepted_china_ssa\x18& \x01(\x08\x12\x1d\n\x15is_banned_steam_china\x18\' \x01(\x08:\n\x80\xa6\x1d\x80\x01\x88\xa6\x1d\x80\x04\"p\n\x0f\x43IPLocationInfo\x12\n\n\x02ip\x18\x01 \x01(\r\x12\x10\n\x08latitude\x18\x02 \x01(\x02\x12\x11\n\tlongitude\x18\x03 \x01(\x02\x12\x0f\n\x07\x63ountry\x18\x04 \x01(\t\x12\r\n\x05state\x18\x05 \x01(\t\x12\x0c\n\x04\x63ity\x18\x06 \x01(\t\">\n\x1b\x43GCMsgGetIPLocationResponse\x12\x1f\n\x05infos\x18\x01 \x03(\x0b\x32\x10.CIPLocationInfo*\x9d\x01\n\x0b\x45GCPlatform\x12\x16\n\x12k_eGCPlatform_None\x10\x00\x12\x14\n\x10k_eGCPlatform_PC\x10\x01\x12\x15\n\x11k_eGCPlatform_Mac\x10\x02\x12\x17\n\x13k_eGCPlatform_Linux\x10\x03\x12\x19\n\x15k_eGCPlatform_Android\x10\x04\x12\x15\n\x11k_eGCPlatform_iOS\x10\x05*\xdb\x01\n\x10GCProtoBufMsgSrc\x12 \n\x1cGCProtoBufMsgSrc_Unspecified\x10\x00\x12\x1f\n\x1bGCProtoBufMsgSrc_FromSystem\x10\x01\x12 \n\x1cGCProtoBufMsgSrc_FromSteamID\x10\x02\x12\x1b\n\x17GCProtoBufMsgSrc_FromGC\x10\x03\x12 \n\x1cGCProtoBufMsgSrc_ReplySystem\x10\x04\x12#\n\x1fGCProtoBufMsgSrc_SpoofedSteamID\x10\x05:9\n\tkey_field\x12\x1d.google.protobuf.FieldOptions\x18\xe0\xd4\x03 \x01(\x08:\x05\x66\x61lse:A\n\x12msgpool_soft_limit\x12\x1f.google.protobuf.MessageOptions\x18\xe0\xd4\x03 \x01(\x05:\x02\x33\x32:B\n\x12msgpool_hard_limit\x12\x1f.google.protobuf.MessageOptions\x18\xe1\xd4\x03 \x01(\x05:\x03\x33\x38\x34')
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Couldn't build proto file into descriptor pool: duplicate symbol 'msgpool_soft_limit'

proto_file.proto:

import "google/protobuf/descriptor.proto";
extend .google.protobuf.FieldOptions {
    optional bool key_field = 60000 [default = false];
}
extend .google.protobuf.MessageOptions {
    optional int32 msgpool_soft_limit = 60000 [default = 32];
    optional int32 msgpool_hard_limit = 60001 [default = 384];
}
enum MYEnums {
    enumone = 1;
    enumtwo = 2;
}
message CMsgProtoBufHeader {
    option (msgpool_soft_limit) = 256;
    option (msgpool_hard_limit) = 1024;
    optional fixed64 client = 1;
}
message CGCSystemMsg_GetDetails {
    option (msgpool_soft_limit) = 128;
    option (msgpool_hard_limit) = 512;
    optional fixed64 id = 1;
}

proto_file_pb2.py:

# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: proto_file.proto
# Protobuf Python Version: 4.25.1
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)

_sym_db = _symbol_database.Default()


from google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2


DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10proto_file.proto\x1a google/protobuf/descriptor.proto\"0\n\x12\x43MsgProtoBufHeader\x12\x0e\n\x06\x63lient\x18\x01 \x01(\x06:\n\x80\xa6\x1d\x80\x02\x88\xa6\x1d\x80\x08\"1\n\x17\x43GCSystemMsg_GetDetails\x12\n\n\x02id\x18\x01 \x01(\x06:\n\x80\xa6\x1d\x80\x01\x88\xa6\x1d\x80\x04*#\n\x07MYEnums\x12\x0b\n\x07\x65numone\x10\x01\x12\x0b\n\x07\x65numtwo\x10\x02:9\n\tkey_field\x12\x1d.google.protobuf.FieldOptions\x18\xe0\xd4\x03 \x01(\x08:\x05\x66\x61lse:A\n\x12msgpool_soft_limit\x12\x1f.google.protobuf.MessageOptions\x18\xe0\xd4\x03 \x01(\x05:\x02\x33\x32:B\n\x12msgpool_hard_limit\x12\x1f.google.protobuf.MessageOptions\x18\xe1\xd4\x03 \x01(\x05:\x03\x33\x38\x34')

_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto_file_pb2', _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
  DESCRIPTOR._options = None
  _globals['_CMSGPROTOBUFHEADER']._options = None
  _globals['_CMSGPROTOBUFHEADER']._serialized_options = b'\200\246\035\200\002\210\246\035\200\010'
  _globals['_CGCSYSTEMMSG_GETDETAILS']._options = None
  _globals['_CGCSYSTEMMSG_GETDETAILS']._serialized_options = b'\200\246\035\200\001\210\246\035\200\004'
  _globals['_MYENUMS']._serialized_start=155
  _globals['_MYENUMS']._serialized_end=190
  _globals['_CMSGPROTOBUFHEADER']._serialized_start=54
  _globals['_CMSGPROTOBUFHEADER']._serialized_end=102
  _globals['_CGCSYSTEMMSG_GETDETAILS']._serialized_start=104
  _globals['_CGCSYSTEMMSG_GETDETAILS']._serialized_end=153
# @@protoc_insertion_point(module_scope)


Ответы (0 шт):