Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: can't set attribute #13

Open
alexwpete opened this issue May 31, 2022 · 1 comment
Open

AttributeError: can't set attribute #13

alexwpete opened this issue May 31, 2022 · 1 comment

Comments

@alexwpete
Copy link

I am attempting to migrate a ros1 package and all is going well for the exception of running the ros_upgrader.py:

I get an attribute error.

File "/home/ubuntu/ros2-migration-tools/porting_tools/cmake_lists_porter.py", line 391, in rule_replace_commands item.name = CatkinToAmentMigration.CMAKE_LISTS_REPLACED_COMMANDS[item.name]
Running Noetic ROS on focal Ubuntu with Python 3.8.10

@msplr
Copy link

msplr commented Mar 21, 2024

I ran into the same issue. This seems to fix it for me:

diff --git a/porting_tools/cmake_lists_porter.py b/porting_tools/cmake_lists_porter.py
index 5e75d08..d497b28 100644
--- a/porting_tools/cmake_lists_porter.py
+++ b/porting_tools/cmake_lists_porter.py
@@ -388,7 +388,7 @@ class CMakeListsPorter():
         """
         for item in filter(lambda item: isinstance(item, cmkp._Command), cmake):
             if item.name in CatkinToAmentMigration.CMAKE_LISTS_REPLACED_COMMANDS:
-                item.name = CatkinToAmentMigration.CMAKE_LISTS_REPLACED_COMMANDS[item.name]
+                item = item._replace(name = CatkinToAmentMigration.CMAKE_LISTS_REPLACED_COMMANDS[item.name])
 

I managed converting the CMakeLists.txt and package.xml.

Unfortunately, I ran into other issues creating the AST with libclang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants