ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

how to use python compiled file instead of source code

asked 2020-06-25 02:49:48 -0500

Kavya K S gravatar image

Hi, i want to launch python node but is there any way i can use .pyc file instead of source .py file?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-06-16 08:15:17 -0500

Ilya Petrov gravatar image

I compiled my project with compileall
File mentioned in node launch should have execution permission (chmod +x)
Renamed module files in ____pycache____ from ModuleName.cpython-37.pyc to ModuleName.pyc (otherwise it throws Import error)
Changed type to .pyc file in launch file:

<node name="rest_api" pkg="hspr" type="rest.cpython-37.pyc" output="screen">

Then it works OK, even after original python files deleted

edit flag offensive delete link more

Comments

1

Hi, I also have the same question as this post. How this solution work for ros2 launch file?

vincewu gravatar image vincewu  ( 2021-12-02 21:55:41 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2020-06-25 02:49:48 -0500

Seen: 482 times

Last updated: Jun 16 '21