Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Use of Google Protobufs

scott.nortman
Enthusiast

Use of Google Protobufs

scott.nortman
Enthusiast
Enthusiast

I am working on an application and would like to use Google Protobufs within my Fusion Python script.

 

I have followed the instructions as listed here

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

 

And I can build / import the protobuf file when using Python at the command line, with the MS Visual Studio Python installation 3.7.5.

 

To get this to work, I needed to install the protobuf libraries via pip:

 

https://pypi.org/project/protobuf/

 

So my question is:  Is the Python installation that MSVS installs the same as what Fusion is using?  If not, how can I install protobuf support in the Python that Fusion uses?

 

Also:  I need to import the *.py protobuf file created by the Google protobuf compiler; how can I get this file on the path as seen by the Fusion Python?    I was debugging  a custom Python script already so I placed the protobuf *.py file in the same directory as my script and I was still unable to import.

 

Thanks for any tips...

 

Scott

 

 

 

0 Likes
Reply
304 Views
1 Reply
Reply (1)

goyals
Autodesk
Autodesk

Fusion is having its own python installation so it is different from VS Python installation. If Protobuf package is self contained then you can keep the installation folder in your script's root directory and then you should be able to import it. Other way is you can append Protobuf's folder in python search path using sys module like

import sys

sys.path.append('path to Protobufs folder')

 

I hope it helps. Thanks.



Shyam Goyal
Sr. Software Dev. Manager
0 Likes