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

No longer runs on 2.0.20256 x86_64? #83

Open
kadakadak opened this issue Sep 21, 2024 · 10 comments
Open

No longer runs on 2.0.20256 x86_64? #83

kadakadak opened this issue Sep 21, 2024 · 10 comments

Comments

@kadakadak
Copy link

Doesn't sound like this is maintained anymore, but on the off chance someone is watching, I believe I've followed the instructions for creating a simple model to export, but when I run the script, nothing happens. No dialogs. No warnings. Not sure how to debug further. If my google translated Japanese is correct, the other person seems to be having a similar problem.

(sorry for the duplicate issue, I some how fat-fingered my return key and created an empty issue)

@kadakadak
Copy link
Author

Text Commands window shows:

SCRIPT ERROR

Traceback (most recent call last):
File "/Users/local/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter/URDF_Exporter.py", line 7, in
from .utils import utils
File "/Users/local/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter/utils/utils.py", line 12, in
from distutils.dir_util import copy_tree
ModuleNotFoundError: No module named 'distutils'

@kadakadak
Copy link
Author

Perhaps the distutils copy_tree import needs to be swapped for the one in shutil?

@kadakadak
Copy link
Author

index 10f6b1a..925b833 100644
--- a/URDF_Exporter/utils/utils.py
+++ b/URDF_Exporter/utils/utils.py
@@ -9,7 +9,7 @@ import adsk, adsk.core, adsk.fusion
 import os.path, re
 from xml.etree import ElementTree
 from xml.dom import minidom
-from distutils.dir_util import copy_tree
+from shutil import copytree
 import fileinput
 import sys
 
@@ -149,7 +149,7 @@ def copy_package(save_dir, package_dir):
     except: pass 
     try: os.mkdir(save_dir + '/urdf')
     except: pass 
-    copy_tree(package_dir, save_dir)
+    copytree(package_dir, save_dir, dirs_exist_ok=True)
 
 def update_cmakelists(save_dir, package_name):
     file_name = save_dir + '/CMakeLists.txt'```

otischung added a commit to screamlab/fusion2urdf that referenced this issue Sep 23, 2024
Note: This modification is cited from issue syuntoku14#83,
created by kadakadak.
I do not claim ownership of the idea for this modification.
@Gautham-Ramkumar03
Copy link

Doesn't sound like this is maintained anymore, but on the off chance someone is watching, I believe I've followed the instructions for creating a simple model to export, but when I run the script, nothing happens. No dialogs. No warnings. Not sure how to debug further. If my google translated Japanese is correct, the other person seems to be having a similar problem.

(sorry for the duplicate issue, I some how fat-fingered my return key and created an empty issue)

it seems the URDF_Exporter_ros2 fork is also not working, nothing happens
it seems like the local libraries like disutils is deprecated
is there any solution?

@tvharikrishna
Copy link

tvharikrishna commented Oct 5, 2024

Solution & Fix: Worked for me

To fix the issue with the URDF_Exporter script, you'll need to update the code to replace the deprecated distutils.dir_util.copy_tree with shutil.copytree, which is supported in the version of Python that Fusion 360 uses.

Steps:

  1. Locate utils.py:

    • Go to the directory where fusion2urdf is installed, typically located in your Fusion 360 API Scripts folder.
    • Open the file utils.py.
  2. Update the Import Statement:
    Find this line:

    from distutils.dir_util import copy_tree

    Replace it with:

    from shutil import copytree
  3. Modify the Function Calls:
    Wherever copy_tree is called, replace it with copytree. You also need to adjust the syntax to match shutil.copytree, which requires the dirs_exist_ok=True argument to avoid errors when directories already exist. Find this line:

    copy_tree(package_dir, save_dir)

    Replace it with:

    copytree(package_dir, save_dir, dirs_exist_ok=True)
  4. Test the Changes:
    Save the changes in utils.py.
    Run the script again in Fusion 360 and test to see if the dialog box for saving the URDF file now appears.

@AbdelmMatoug
Copy link

Dear, I've followed these steps but I'm now getting "SCRIPT ERROR" in the text command, and nothing pops up.

Kind regards.

@TheHassanShahzad
Copy link

Hi this still isnt working for me. nothing shows up, no dialog box

@luc1fer06
Copy link

I Did the above changes for ros 1 and it worked but it's not working for ros 2

Failed:
Traceback (most recent call last):
File "C:/Users/admin/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter_Ros2/URDF_Exporter_Ros2.py", line 86, in run
utils.create_package(package_name, save_dir, package_dir)
^^^^^^^^^^^^^^^^^^^^
AttributeError: module '__main__C%3A%2FUsers%2Fadmin%2FAppData%2FRoaming%2FAutodesk%2FAutodesk%20Fusion%20360%2FAPI%2FScripts%2FURDF_Exporter_Ros2%2FURDF_Exporter_Ros2_py.utils.utils' has no attribute 'create_package'

i am facing the above error can someone help

@Oyefusi-Samuel
Copy link

I Did the above changes for ros 1 and it worked but it's not working for ros 2

Failed: Traceback (most recent call last): File "C:/Users/admin/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter_Ros2/URDF_Exporter_Ros2.py", line 86, in run utils.create_package(package_name, save_dir, package_dir) ^^^^^^^^^^^^^^^^^^^^ AttributeError: module '__main__C%3A%2FUsers%2Fadmin%2FAppData%2FRoaming%2FAutodesk%2FAutodesk%20Fusion%20360%2FAPI%2FScripts%2FURDF_Exporter_Ros2%2FURDF_Exporter_Ros2_py.utils.utils' has no attribute 'create_package'

i am facing the above error can someone help

to fix this error you just have to simply check your design to crosscheck design delete errors

@abdvswmdr
Copy link

I Did the above changes for ros 1 and it worked but it's not working for ros 2
Failed: Traceback (most recent call last): File "C:/Users/admin/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/Scripts/URDF_Exporter_Ros2/URDF_Exporter_Ros2.py", line 86, in run utils.create_package(package_name, save_dir, package_dir) ^^^^^^^^^^^^^^^^^^^^ AttributeError: module '__main__C%3A%2FUsers%2Fadmin%2FAppData%2FRoaming%2FAutodesk%2FAutodesk%20Fusion%20360%2FAPI%2FScripts%2FURDF_Exporter_Ros2%2FURDF_Exporter_Ros2_py.utils.utils' has no attribute 'create_package'
i am facing the above error can someone help

to fix this error you just have to simply check your design to crosscheck design delete errors

You mean errors from Fusion360?

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

8 participants