Adding Custom Python Packages

Hi! I’m building a custom HLA for a project I’m working on. However, I need to add a library that we built ourselves. I added the library folder to the same folder housing all the HLA files and I’m just doing an import like the following:

from proto.[file].[class] import NodeState

Each time I do this, I’m getting an error saying "Saleae Protocol Decoder error - ModuleNotFoundError(“No module named '[file].[class]”. Is there something I can do? I tried one of the solutions I found on the forum, however, I might’ve implemented it incorrectly since it didn’t work.

Any help would be appreciated!

@fkbokovi Thanks for writing in, and sorry for the trouble with that. Can you confirm if you’ve tried the solution that Mark shared below?

1 Like

Apologies for the late response, I haven’t been in the office for a bit. I will try that right away. I’ve never used requirements.txt before so I’m gonna figure that out right now and try it out and get back to you.

Alright I tried that solution and I’m still not able to get it to work. I first tried it with my lib folder in the same directory holding the hla.py and I get the following error, "Saleae Protocol Decoder error - ModuleNotFoundError(“No module named ‘google’”):

 File "C:\Program Files\Logic\resources\windows\pythonlibs\lib\site-packages\saleae\_module_space.py", line 251, in load_module
    self._inner_loader.exec_module(module)

  File "C:\Git\VI Projects\Saleae vicom protocol decoder\Saleae Protocol Decoder\HighLevelAnalyzer.py", line 9, in <module>
    from lib.python.proto.nextbot.node_pb2 import NodeState

  File "C:\Git\VI Projects\Saleae vicom protocol decoder\Saleae Protocol Decoder\lib\python\proto\nextbot\node_pb2.py", line 5, in <module>
    from google.protobuf.internal import builder as _builder

When I tried with the right outside that directory, it can’t find the file to import from.

@fkbokovi Hm… let me forward this over to our software team. We’ll be in touch.

Alright, I figured out my issue! The way I created my requirements.txt file was incorrect so I my imports weren’t working correctly.

Thanks for your help!

1 Like