The purpose of that line is to declare that the "google" package is just a namespace, so that other google projects (like AppEngine) can also place their code under "google". In retrospect, we probably should have just created a top-level "protobuf" package.
If you make sure that all packages that you are using under "google" are part of one big source tree, then the line is unnecessary -- it is only needed when the "google" package might appear in multiple locations in your python path. So if this is the case for you, you can simply replace that __init__.py with an empty file. On Thu, Apr 8, 2010 at 12:22 PM, Nick Carter <[email protected]> wrote: > My project pulls the protobuf source directly from code.google.com, and > builds the tools and libs (protoc, libprotobuf, libprotobuf-lite) as part of > its build process. But now I want to use protos from Python, and I'm having > trouble getting the python protobuf library to import properly from the > generated _pb2.py code. > > Protobuf's > python/<http://code.google.com/p/protobuf/source/browse/trunk/python/> > directory > is in my PYTHONPATH, but my standalone python build chokes on the > python/google/__init__.py: > > > __import__('pkg_resources').declare_namespace(__name__) > > > > > because the hermetic python used by my build doesn't have setuptools. > Simply removing that line (or adding a try/except for ImportError) seems to > make things to work for me. > > Do I really need to pull in setuptools, in order to use python protobufs? > Or is there a way to make the pkgresources dependency optional? > > - nick > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<protobuf%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
