Python files are generally located at $CEI_HOME/ensight212/site_preferences/extensions. This directory contains two sub-directories: core and user_defined. The contents of the former are discussed in the next couple of sections. The ‘user_defined’ directory contains the various EnSight extensions that are loaded on startup. A fairly large number of default extensions are included in this directory by default.
When the module ensight.core is imported, it defines a method ‘load_extensions()’ which is called by the ensight ‘C’ startup code. When load_extensions() is invoked, it walks the subdirs in the sys.path names that end with the directory ‘extensions’ (see ‘Startup’ above). If the sub-directory contains a __init__.py file, the subdir is ‘import’ed into the module ensight.ext (note: ensight.ext.__path__ is modified to include the ‘extensions’ directory names).
While EnSight does not support PYTHONPATH, it does support the environmental variable CEI_PYTHONPATH. Setting this environmental variable to a list of directories will cause those directories to be added to sys.path on startup. For example:
will both add two directories to sys.path on Linux and Windows respectively.
The EnSight Product/Package extension system can also be used to extend sys.path. If a product.xml file points to a loading python file that does not load any extensions, it will still add the directory containing the product.xml file to sys.path. For example, a folder containing a 'product.xml' file with the contents:
<?xml version="1.0" encoding="UTF-8"?>
and the file 'dummy.py' with these contents being placed in the same folder:
will cause the folder containing the files in sys.path, without actually installing any extensions. These folders can be located in '.ensightXXX/extensions' directories or $CEI_HOME. The product.xml file can also be used to restrict the folder addition to specific releases of EnSight.
The EnSight Python startup sequence looks like: