Having an issue in cmake while colcon building the px4_msgs

colcon build
Starting >>> px4_msgs
— stderr: px4_msgs
CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
execute_process(/usr/bin/python3 -m rosidl_adapter --package-name px4_msgs
–arguments-file
/home/junaid/ros2_px4_offboard_example_ws/build/px4_msgs/rosidl_adapter__arguments__px4_msgs.json
–output-dir
/home/junaid/ros2_px4_offboard_example_ws/build/px4_msgs/rosidl_adapter/px4_msgs
–output-file
/home/junaid/ros2_px4_offboard_example_ws/build/px4_msgs/rosidl_adapter/px4_msgs.idls)
returned error code 1:

AttributeError processing template ‘msg.idl.em’

Traceback (most recent call last):

File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 51, in evaluate_template
  em.BUFFERED_OPT: True,

AttributeError: module ‘em’ has no attribute ‘BUFFERED_OPT’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
  return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
  exec(code, run_globals)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__main__.py", line 19, in <module>
  sys.exit(main())
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/main.py", line 53, in main
  abs_idl_file = convert_to_idl(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__init__.py", line 19, in convert_to_idl
  return convert_msg_to_idl(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/msg/__init__.py", line 39, in convert_msg_to_idl
  expand_template('msg.idl.em', data, output_file, encoding='iso-8859-1')
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 23, in expand_template
  content = evaluate_template(template_name, data)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/resource/__init__.py", line 69, in evaluate_template
  _interpreter.shutdown()

AttributeError: ‘NoneType’ object has no attribute ‘shutdown’

Call Stack (most recent call first):
/opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
CMakeLists.txt:28 (rosidl_generate_interfaces)


Failed <<< px4_msgs [0.33s, exited with code 1]

Summary: 0 packages finished [0.44s]
1 package failed: px4_msgs
1 package had stderr output: px4_msgs

please anyone help me

probably, this?

check which version of empy you have, for example I have 3.3.4, and it works fine for me, with ros2 humble:

pip list | grep em
empy                                 3.3.4

as an alternative, you can just start using mavros for communicating with px4 instead of px4_msgs