Calling document.dataFile raises error if document was just saved to datafile

Calling document.dataFile raises error if document was just saved to datafile

lorraine5RWGT
Enthusiast Enthusiast
479 Views
1 Reply
Message 1 of 2

Calling document.dataFile raises error if document was just saved to datafile

lorraine5RWGT
Enthusiast
Enthusiast

 

 

 

 

 

    # Document creation options
    documentType = adsk.core.DocumentTypes.FusionDesignDocumentType # int 0
    visible = True  # Fusion currently only supports True
    options = None
    doc = app.documents.add(documentType, visible, options)
    description = ''
    tag = ''

    # Save version 1
    doc.saveAs(datafile_name, folder, description, tag)

    time.sleep(15)  # testing, arbitrary

    doc.activate()

    # Workaround to Fusion's 'Failed to download file' error
    time.sleep(6)

    print('doc.isSaved: ' + str(doc.isSaved))
    print('doc.isValid: ' + str(doc.isValid))
    print('doc.dataFile: ' + str(doc.dataFile))

 

 

 

 

 

 

 

 

 

 

 

Output: 

doc.isSaved: True
doc.isValid: True
[...]
RUntimeError: 2 : InternalValidationError : dataFile

 

 

 

 

 

 

 

480 Views
1 Reply
Reply (1)
Message 2 of 2

goyals
Autodesk
Autodesk

May be file is not uploaded to the cloud yet and you are trying to get dataFile early hence this problem is noticed though file is saved locally. Not sure what is the best way to know when file is actually uploaded to cloud. We do have DataFileFuture class defined which is used when file is uploaded directly using upload function on DataFolder so may be we should provide similar object in case of Save. 



Shyam Goyal
Sr. Software Dev. Manager
0 Likes