diff --git a/msg/templates/urtps/Publisher.cpp.em b/msg/templates/urtps/Publisher.cpp.em index bbfb2aa27d..99755457bc 100644 --- a/msg/templates/urtps/Publisher.cpp.em +++ b/msg/templates/urtps/Publisher.cpp.em @@ -16,7 +16,10 @@ import gencpp from px_generate_uorb_topic_helper import * # this is in Tools/ topic = alias if alias else spec.short_name -ros2_distro = ros2_distro.decode("utf-8") +try: + ros2_distro = ros2_distro.decode("utf-8") +except AttributeError: + pass }@ /**************************************************************************** * @@ -58,6 +61,7 @@ ros2_distro = ros2_distro.decode("utf-8") * This file was adapted from the fastcdrgen tool. */ + #include #include #include diff --git a/msg/templates/urtps/Publisher.h.em b/msg/templates/urtps/Publisher.h.em index 343adbcae3..eda208e4fd 100644 --- a/msg/templates/urtps/Publisher.h.em +++ b/msg/templates/urtps/Publisher.h.em @@ -16,7 +16,10 @@ import gencpp from px_generate_uorb_topic_helper import * # this is in Tools/ topic = alias if alias else spec.short_name -ros2_distro = ros2_distro.decode("utf-8") +try: + ros2_distro = ros2_distro.decode("utf-8") +except AttributeError: + pass }@ /**************************************************************************** * diff --git a/msg/templates/urtps/RtpsTopics.cpp.em b/msg/templates/urtps/RtpsTopics.cpp.em index f9404c4a58..666089ed85 100644 --- a/msg/templates/urtps/RtpsTopics.cpp.em +++ b/msg/templates/urtps/RtpsTopics.cpp.em @@ -21,7 +21,10 @@ send_topics = [(alias[idx] if alias[idx] else s.short_name) for idx, s in enumer recv_topics = [(alias[idx] if alias[idx] else s.short_name) for idx, s in enumerate(spec) if scope[idx] == MsgScope.RECEIVE] package = package[0] fastrtpsgen_version = fastrtpsgen_version[0] -ros2_distro = ros2_distro[0].decode("utf-8") +try: + ros2_distro = ros2_distro[0].decode("utf-8") +except AttributeError: + ros2_distro = ros2_distro[0] }@ /**************************************************************************** * diff --git a/msg/templates/urtps/Subscriber.cpp.em b/msg/templates/urtps/Subscriber.cpp.em index 4f2a3a2542..e475f61045 100644 --- a/msg/templates/urtps/Subscriber.cpp.em +++ b/msg/templates/urtps/Subscriber.cpp.em @@ -16,7 +16,10 @@ import gencpp from px_generate_uorb_topic_helper import * # this is in Tools/ topic = alias if alias else spec.short_name -ros2_distro = ros2_distro.decode("utf-8") +try: + ros2_distro = ros2_distro.decode("utf-8") +except AttributeError: + pass }@ /**************************************************************************** * diff --git a/msg/templates/urtps/Subscriber.h.em b/msg/templates/urtps/Subscriber.h.em index 01760c7ea2..64e5fbcecd 100644 --- a/msg/templates/urtps/Subscriber.h.em +++ b/msg/templates/urtps/Subscriber.h.em @@ -16,7 +16,10 @@ import gencpp from px_generate_uorb_topic_helper import * # this is in Tools/ topic = alias if alias else spec.short_name -ros2_distro = ros2_distro.decode("utf-8") +try: + ros2_distro = ros2_distro.decode("utf-8") +except AttributeError: + pass }@ /**************************************************************************** *