Regression test script help

Issue #86 resolved
Noname created an issue

Hello,

So I’m writing, well trying to anyways :), simple script that will import set of *.duf files and than maybe i..e compare imported objects, positions etc. with provided data.

At this point I can import files from my python script but the problem is that I can’t detect if daz iImporter did errored out or no.

My questions:

  • AFAIKT there is no way to catch exception from my script that happens on daz import script right ?
  • is it possible to either access now or maybe add some sort of method that will be invoked after import that will return bool like isImportError() or something similar

Such script could be later on expanded to i.e. read external JSON file with additional information like file path, vertex / object count, objects positions etc.

Comment more then welcome.

Comments (5)

  1. Thomas Larsson repo owner

    I added a new addon which illustrates how to invoke the daz importer from python (sample_addon.py in the addons directory, cf http://diffeomorphic.blogspot.com/2019/07/add-ons.html). The function getErrorMessage() retrieves the error message printed in the popups. If there are no errors the error message is the empty string ““, and if there is only a warning it begins with “WARNING”. You probably also want to temporarily turn off popups which require user interaction with setSilentMode. Both functions are located in error.py.

    So the code should look something like this:

            from ..error import getErrorMessage, setSilentMode
            setSilentMode(True)     # Turn off error popups
            ...                     # Do something        
            msg = getErrorMessage() # The error message is the empty string if there are no errors
            setSilentMode(False)    # Turn error popups on again
    

  2. Log in to comment