Hi @sharas_s ,
I had the same problem in my environment. I'm running Fusion360's latest version "2.0.13377".
I made a change to check the status of the upload process not with the future flag, but instead with the dataFile.isComplete attribute. Other change I made was to send all files creations requests at once, and then make only one monitoring loop. With this change both launchers (simple and commandInput) run successfully.
The conclusion I have is that the file status in the DataFileFuture.uploadState attribute is not updated, while the dataFile.isComplete attribute report the real status of the file.
This is code with the modifications I made in upload.py:
def upload_file(folder, filepath):
'''
Use DataFileFuture to check upload state
'''
future = folder.uploadFile(filepath)
adsk.doEvents()
return future
n = 0
while True:
n += 1
futil.log(f'folder: {folder.name}, state: {future.uploadState}, valid: {future.isValid} - {n}')
if future.uploadState == adsk.core.UploadStates.UploadFinished:
return
elif future.uploadState == adsk.core.UploadStates.UploadFailed:
raise Exception("upload failed")
adsk.doEvents()
def templates(template, quantity=1):
app = adsk.core.Application.get()
folder = app.data.activeProject.rootFolder
name_template = 'blank'
regex = re.compile( r'v\d+' ) # regex to find version number in filename
template_version = regex.findall( template )[ 0 ]
template_filepath = os.path.join( config.TEMPLATE_FOLDER, template ).replace( "\\", "/" )
futureDict = {}
folderDict = {}
folder_idx = 1
for _ in range(quantity):
# find unused indexes
used_folder_names = [ doc.name for doc in folder.dataFolders]
while f'{name_template}_{folder_idx}' in used_folder_names:
folder_idx += 1
# create folder for template
blank_name = f'{name_template}_{folder_idx}'
blank_folder = folder.dataFolders.add(
f"{blank_name}"
)
adsk.doEvents()
left_blank_folder = blank_folder.dataFolders.add(
f"Left_{template_version}"
)
adsk.doEvents()
right_blank_folder = blank_folder.dataFolders.add(
f"Right_{template_version}"
)
adsk.doEvents()
# start uploading template
# Option 1
k = f'L{_}'
futureDict[k] = upload_file( left_blank_folder, template_filepath)
folderDict[k] = left_blank_folder
v = folderDict[k]
k = f'R{_}'
futureDict[k] = upload_file( right_blank_folder, template_filepath)
folderDict[k] = right_blank_folder
v = folderDict[k]
n = 0
while True:
adsk.doEvents()
succ = 0
fail = 0
comp = 0
status = ''
n += 1
for k,v in futureDict.items():
r = v.uploadState
if r == adsk.core.UploadStates.UploadFinished:
succ += 1
elif r == adsk.core.UploadStates.UploadFailed:
fail += 1
df = adsk.core.DataFolder.cast(folderDict[k])
if df and df.dataFiles and df.dataFiles.count and df.dataFiles.item(0):
if df.dataFiles.item(0).isComplete:
x = 'T'
comp += 1
else:
x = 'F'
else:
x = ' '
status += f'{k} {r}{x[0]} '
futil.log(f'{status} {comp} {n}')
if succ + fail == quantity * 2 or comp == quantity * 2:
return
Take a look at the output messages where I print the status of each file it finds in the waiting loop:

In yellow the files ID, in orange the future attribute and in green the dataFile.isComplete attribute.
Notice all orange equal to 0 (UploadProcessing) while the greens vary on each iteration.
First run was made with commandInput while second was made with simple script.
I hope this could help support team to check why the inconsistency in the two attributes is happening.
Let me know if it works for you on your environment.
Regards,
Jorge