Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 496169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:39:38+00:00 2026-05-13T05:39:38+00:00

When using the generated Python code from our protobuf classes, we get this error:

  • 0

When using the generated Python code from our protobuf classes, we get this error:

cannot import name descriptor_pb2

The equivalent C++ generated code works just fine, so it would appear that there is no problem with our actual proto definitions.

This error occurs when I try and import our class, like so:

import sys
sys.path.append('..\path\to\generated')
sys.path.append('..\contrib\protobuf\python')

from foobar_pb2 import FooBar

Is it correct to append the system paths?

I checked in the protobuf\python\google\protobuf directory for descriptor_pb2.py but only found descriptor.py – we’re using the latest version, so I assume we don’t have any files missing.

Does anyone know what the solution is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:39:39+00:00Added an answer on May 13, 2026 at 5:39 am

    I believe you have to generate descriptor_pb2.py with protoc yourself:

    protoc descriptor.proto --python_out=gen/
    

    gen/ is a folder with generated python classes.

    After that, the following works just fine:

    sys.path.append('../gen')
    from descriptor_pb2 import FileDescriptorSet
    

    ../gen/descriptor_pb2.py must exists.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I found this code: #!/usr/bin/python import sys #for cmd line argv import time
i've got this snazzy python code: import subprocess value = subprocess.Popen([php,./php/php_runner.php],stdout=subprocess.PIPE); the problem is,
Assume that I have some HTML code, like this (generated from Markdown or Textile
I'm writing a code using python to generate a point shapefile within ArcMAP. I
Using an example from the Python DOCs: stocks = [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
I have a Python dictionary that I generated from an arcgis shapefile. The dictionary
I'm using Python and its MySQLdb module to import some measurement data into a
I've written a very simple code in python and generated one .exe with py2exe.
I'm trying to save a dynamic pdf file generated from a web server using
I want to send a csv file from Android to Python AppEngine. I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.