Can't get Google Protocol Buffer to compile

I am following the google python tutorial for the protocol buffer, I have been able to successfully do everything up until the compiler.

https://developers.google.com/protocol-buffers/docs/pythontutorial

The tutorial says the following:

Now run the compiler, specifying the source directory (where your application's source code lives – the current directory is used if you don't provide a value), the destination directory (where you want the generated code to go; often the same as $SRC_DIR), and the path to your .proto. In this case, you...:

protoc -I=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/addressbook.proto

Say I have the addressbook.proto file located on my desktop and the desktop is also where I want the generated code to go, what should the above terminal command then look like?

Answers


Assuming that you are working under linux, you could set the $SRC_DIR variable like this (note that I dropped the DST_DIR):

SRC_DIR="/home/USERNAME/Desktop" protoc -I=$SRC_DIR --python_out=$SRC_DIR $SRC_DIR/addressbook.proto

Or you could replace every $SRC_DIR and $DST_DIR with "/home/USERNAME/Desktop" (this will work on windows too if you instead use the path to your Desktop..)


In the future, if you don't want to compile Python proto classes yourself, you might consider the gtfs-realtime-bindings PyPI package, which provides pre-generated Pythong language bindings for GTFS-realtime. More details at:

https://github.com/google/gtfs-realtime-bindings/tree/master/python

(Full disclosure: I maintain these packages)


Need Your Help

Bootstrap Carousel Not Sliding Until Mouseover or Click

javascript jquery json twitter-bootstrap

Bootstrap Carousel Not Sliding Until Mouseover or Click: I've been working on this issue for sometime now and have yet to find a solution. I understand this potentially is a duplicate question, but I

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.