How to import msg file by using executable file?
Does ROS system offer any methods to hide the source code?
Because I receive a requirement to hide my ROS code.
Thus, I choose pyinstaller to make .py file into the executable file
After finishing the compile by command: pyinstaller -F mycode.py
Then, using launch file to launch the executable file
But it shows up a ImportError: cannot import name motorCmd (where "motorCmd" is a self-defined msg file I make)
I have tried the following method and still cannot resolve the problem:
- Put msg file with the executable file at the same path (ie: "dist" dir, which is auto-generated by pyinstaller).
Make a hook-file under the pyinstaller hooks dir as following:
hook file.py:
from PyInstaller.utils.hooks import collectdatafiles
datas = collectdatafiles("package") #package is ros package under the "catkin_ws" path
Configuration:
OS : ubuntu 16.04
ROS version: Kinetic
Asked by MengWei on 2019-12-24 00:49:55 UTC
Comments
You are against the spirit of ROS by hiding your code.
Asked by CroCo on 2021-10-28 04:42:20 UTC