Running Python During Startup

On startup, Hiero and HieroPlayer scan various directories for Python scripts that customize the behavior of the application. These scripts can be downloaded from online resources and placed in specific locations on disk, depending on the platform you’re using.

If you’re familiar with Python scripting, you can place custom startup scripts in the same locations, though bear in mind that you should take care as mistakes can produce performance issues.

Some example scripts are included in the application package in the following directories:

On Mac:

/Applications/Hiero15.1v4/Hiero15.1v4.app/Contents/Plugins/site-packages/hiero/examples/

On Linux:

/usr/local/Hiero15.1v4/Plugins/site-packages/hiero/examples/

On Windows:

drive letter:\Program Files\Hiero15.1v4\plugins\site-packages\hiero\examples

At startup, Hiero and HieroPlayer search <path>/Python/Startup and <path>/Python/StartupUI for any Python .py modules or packages containing __init__.py. Scanning is done in two passes - all the Startup folders are searched and then all the StartupUI folders.

You can also add your own Startup folders, which are scanned after the standard paths, by creating a Python file pointing to the custom location. For example:

import hiero.core

hiero.core.addPluginPath("/myCustomPlugins")

Searches /myCustomPlugins/Python/Startup after the standard paths.

Each package or module discovered is imported and added to the built-in package hiero.plugins.

Note:  Python startup scripts are imported in alphabetical order so you can force ordering if necessary.

The <path> varies by platform as follows:

Mac

/Applications/Hiero15.1v4/Hiero15.1v4.app/Contents/Plugins

/Library/Application Support/TheFoundry/Hiero

~/Library/Application Support/TheFoundry/Hiero

~/.nuke

Linux

/usr/local/Hiero15.1v4/Plugins

~/.nuke

Windows

drive letter:\Program Files\Hiero\plugins\hieroscripts

drive letter:\Program Files (x86)\Hiero\plugins\hieroscripts

~\.nuke

Note:  The .nuke folder can be found under the directory pointed to by the HOME environment variable. If this variable is not set (which is common), the .nuke directory is under the folder specified by the USERPROFILE environment variable - which is generally of the form drive letter:\Documents and Settings\login name\ or drive letter:\Users\login name\

To find out if the HOME and USERPROFILE environment variables are set and where they are pointing at, enter %HOME% or %USERPROFILE% into the address bar in Windows Explorer. If the environment variable is set, the folder it’s pointing at is opened. If it’s not set, you get an error.

You can specify any number of user-defined paths using the environment variable HIERO_PLUGIN_PATH, separating them with : just like the standard unix PATH environment variable and Nuke's NUKE_PATH. See Setting Environment Variables for more information.