import_daz operator fails when called via script

Issue #1188 invalid
Luke Graybill created an issue

Using commit 69a29d0, the bpy.ops.daz.import_daz() operator fails:

Importing works properly when using the panel buttons, this appears to only be a problem when called via a separate script.

This exact same code works as expected at least as far back as e6ea880 (I think that was in Apr 2022, so just after 1.6.1 was released?) I know that’s a huge range of time for things to have gone wrong or changed, but I didn’t see any mention in the docs for 1.6.2 about `set_selection` behavior changing, but perhaps that’s what caused this, in which case this is possibly a documentation bug?

Comments (5)

  1. Luke Graybill reporter
    import bpy
    from bpy.path import abspath
    import import_daz
    
    import_daz.clear_selection()
    import_daz.set_selection([
        abspath('//sources/genesis-8-female.duf'),
    ])
    
    bpy.ops.daz.import_daz()
    

    (forgot to attach the script)

  2. Thomas Larsson repo owner

    Strange, it works here. It is also somewhat difficult to trigger the error you get, if some files are missing I tend to get other errors:

    • If the dbz file is missing, I get an error saying that.
    • If the duf file is missing, the error is that the file doesn’t exist.

    However, I can trigger your error if I change the file extension to something different from .duf or .dsf.

  3. Luke Graybill reporter

    I am also unable to recreate this error now! Perhaps I had some pycache files conflicting that got cleared out?

    Either way, my apologies for wasting your time, it seems that all is good after all!

  4. Log in to comment