Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This hook can be used to edit, reformat or add additional values to the export elements from the settings page of the library elements.

...

Info

Tip: use this hook to create a CSV file that you can import into Shotgrid

...

Code Block
def main(*args, logger=none):
    items = args[0]

    # use the Das Element logger
    # will log to  ~/.das-element/logs/
    
    logger.warning('This is a warning!')
    
    return items

if __name__ == '__main__':
    main(sys.argv[1:])

Print inside python file

To output data to the console when customizing the hook files use a print statement inside the main function. The input args will be a list of data.

To get a better idea what’s happening inside the hook files you can follow these steps:

...

inside the Python hook file you can add print statements

Code Block
print(item)
print(item['path'])

...

start a terminal/command prompt

...

activate the debug mode - set the environment variable

Code Block
# Linux/MacOS
export DASELEMENT_LOG_LEVEL=debug
# Windows
set DASELEMENT_LOG_LEVEL=debug

...

now run the software via the command line

Code Block
# Linux
/opt/das-element-1.2.1/das-element-1.2.1

# MacOS
/Applications/das-element-1.2.1.app/Contents/MacOS/das-element-1.2.1

# Windows
"C:\Program Files\das element\das element 1.2.1\das element 1.2.1.exe"

...


Example for pre_load_ingest.py

...