Error with Add-In only on startup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been working on a custom API for incremental part numbering, and it works great if I run it manually. However, on startup I get an error that I haven't been able to figure out the meaning of. I've included the error that displays in the text window below:
Traceback (most recent call last):
File "C:/Users/rmcla/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/Seabound_Part/Seabound_Part.py", line 9, in run
commands.start()
File "C:\Users/rmcla/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/Seabound_Part\commands\__init__.py", line 24, in start
command.start()
File "C:\Users/rmcla/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/Seabound_Part\commands\incremental_part\entry.py", line 75, in start
new_subsystem_dict = futil.refresh_part_numbers() # custom function in general_utils.py
File "C:\Users/rmcla/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/Seabound_Part\lib\fusion360utils\general_utils.py", line 208, in refresh_part_numbers
raw_parts_dict__ = get_existing_parts() # another custom function, used by refresh_part_numbers()
File "C:\Users/rmcla/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/Seabound_Part\lib\fusion360utils\general_utils.py", line 137, in get_existing_parts
files_to_unpack = this_project_.rootFolder.dataFiles.asArray() # get files in the root folder
File "C:\Users/rmcla/AppData/Local/Autodesk/webdeploy/production/414da7cdec4faa7986fe0d205fb521fc68f5d46c/Api/Python/packages\adsk\core.py", line 8105, in asArray
return _core.DataFiles_asArray(self)
RuntimeError: 2 : InternalValidationError : status.isOk() && files
For context, I've also included a snippet from where the error is originating.
active_hub_ = app.data.activeHub
log(f'Active hub: {active_hub_.name}')
all_projects = active_hub_.dataProjects.asArray() # capture all projects in list of DataProject objects
for this_project_ in all_projects:
files_to_unpack = this_project_.rootFolder.dataFiles.asArray() # get files in the root folder as a list
I reference the active hub and all data projects associated with it, and then loop through each project to check for files . My only idea is that the connection to the data hub needs some time to process, but I don't understand enough about how that connection is established to theorize further.
Like I said, this issue is only on startup. If I stop and re-run the Add-In from the Scripts and Add-Ins menu, there are no issues.
Any help would be appreciated! Thanks!