Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use of Google Protobufs

1 REPLY 1
Reply
Message 1 of 2
scott.nortman
178 Views, 1 Reply

Use of Google Protobufs

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

 

 

 

1 REPLY 1
Message 2 of 2
goyals
in reply to: scott.nortman

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report