Python Module Support

From VisItusers.org

Jump to: navigation, search

With the 2.5 release, VisIt's python module was modified to include packing of python scripts and resolve import namespace issues with the compiled module.

After these changes, users need to use a different path to import the module from a standalone python interpreter:

[edit] Using the visit module from a standalone python

[edit] Importing from an installed version of VisIt

If VisIt is in your path:

import sys
sys.path.insert(0,"path/to/visit/<ver>/<arch>/lib/site-packages/")
import visit
visit.Launch()

If VisIt is is not in your path:

import sys
sys.path.insert(0,"path/to/visit/<ver>/<arch>/lib/site-packages/")
import visit
visit.Launch(vdir="path/to/visit/bin")

Note about use on OSX: visit.Launch() handles the DYLD_LIBRARY_PATH setup for the other VisIt components, however it is not possible to change the DYLD_LIBRARY_PATH used for the dynamic load of the visitmodule by the frontend. So on OSX you need to set DYLD_LIBRARY_PATH before you launch python

>export DYLD_LIBRARY_PATH=path/to/visit/<ver>/<arch>/lib/
>python


[edit] Importing from a development version of VisIt

If 'build/bin' is in your path:

import sys
sys.path.insert(0,"path/to/visit/lib/site-packages/")
import visit
visit.Launch()

If 'build/bin' is not in your path:

import sys
sys.path.insert(0,"path/to/visit/build/lib/site-packages/")
import visit
visit.Launch(vdir="path/to/visit/build/bin")
Personal tools