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

  • SEARCH
  • Home
  • 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 3282534
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:56:20+00:00 2026-05-17T19:56:20+00:00

I have my directory structure like this: root/ sift/ __init__.py sift_descriptors.proto sift_descriptors_pb2.py project/ __init__.py

  • 0

I have my directory structure like this:

root/
  sift/
    __init__.py
    sift_descriptors.proto
    sift_descriptors_pb2.py
  project/
    __init__.py
    filtered_descriptors.proto
    filtered_descriptors_pb2.py
    filtered_descriptors_test.py

The root directory is in my $PYTHONPATH.

I build root/sift/sift_descriptors_pb2.py using protoc --python_out=./ sift_descriptors.proto

I build root/project/filtered_descriptors_pb2.py using /cs/public/lib/pkg/protobuf/bin/protoc --proto_path=../sift --proto_path=./ --python_out=./ filtered_descriptors.proto

In filtered_descriptors.proto, I use import "sift_descriptors.proto"

The problem is that in filtered_descriptors_pb2.py (produced by protoc), there’s a statement that just does this bare import: import sift_descriptors_pb2, without reference via the module name as would be needed: from sift import sift_descriptors_pb2.

What am I doing wrong?

  • 1 1 Answer
  • 1 View
  • 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-17T19:56:20+00:00Added an answer on May 17, 2026 at 7:56 pm

    I fixed it!

    The solution was to use import "sift/sift_descriptors.proto" in filtered_descriptors.proto, and then point protoc to --proto_path=../ instead of --proto_path=../sift.

    Then, protoc generates python code that does the import as import sift.sift_descriptors_pb2.

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

Sidebar

Related Questions

I have an Xcode project with a directory structure like this: MasterProjectDir/projectname.xcodeproj MasterProjectDir/ProjectSubDir/whatever.c MasterProjectDir/ProjectSubDir/etc.c
I have this directory structure. In my project root directory I have a main
I have a project with a directory structure that looks like: /foo/baz/__init__.py /bar/foo.py /bar/splat.py
I have a directory structure like this: root folder1 abc.json def.json somedir more.json folder2
I have a directory structure in my project (something) similar to this one: Root
I have a directory structure like this: - Root - Versioned deployment folder -
I have a directory structure like this Root Sub Dir A Content Admin And
When creating gems, I often have a directory structure like this: |--lib |-- helpers.rb
I am a beginner in SVN.I have the SVN directory structure like this: |-trunk
I have a directory structure that looks like this: /a/f.xml /b/f.xml /c/f.xml /d/f.xml What

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.