...
directory defined in the
$DASELEMENT_RESOURCES/scripts/hooks
environment variableyour local
.das-element
folder (for Linux:~/.das-element/scripts/hooks
or for Windows%homepath%/.das-element/scripts/hooks
)
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.
You will need to activate the debugging mode.
Code Block |
---|
export DASELEMENT_LOG_LEVEL=debug |
...
Code Block |
---|
def main(*args):
items = args[0]
for item in items:
print(item) # <- this print() will be output to the console
return items
if __name__ == '__main__':
main(sys.argv[1:]) |
Pre Render Hook
The input is the resolver data dictionary
which will be used to resolve the path pattern. You can modify it here before the transcoding task gets processed.
...
https://github.com/das-element/resources/blob/main/scripts/hooks/examples/shotgrid/pre_export.py
Troubleshooting
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"
If you make changes to the hook file you will need to restart the application to re-read these changes
Example for pre_load_ingest.py
Code Block |
---|
def main(*args):
items = args[0]
for item in items:
print(item) # <- this print() will be output to the console
return items
if __name__ == '__main__':
main(sys.argv[1:]) |