This document is for OpenStructure version 2.7, the latest version is 2.9.0 !

ost.settings - Locate Files and Retrieve Preferences

exception FileNotFound(name, reason)

Raised when Locate() is unable to locate a file. The exception contains detailed information on what was tried to locate the file, i.e. search paths, environment variables and also provides useful hints on how to let Locate know where to find the file.

GetPlatform()

Returns platform.system(). If the system call is interrupted, it is repeated. This function is a workaround for the buggy system call handling in Python.

GetValue(val_key, val_default=None, prefix='OST')

Returns the value of the variable val_key if defined, otherwise returns the default value provided by the user (if provided). Search order:

  • environment variable called $prefix_$val_key

  • variable called val_key in .ostrc file

Locate(file_name, explicit_file_name=None, search_paths=[], env_name=None, search_system_paths=True)

Helper function to locate files. To get the full name of an executable, let’s say qmake, use

abs_qmake_path=Locate('qmake', env_name='QMAKE_EXECUTABLE')

First the function checks if an environment variable with the name QMAKE_EXECUTABLE is set. If so, the value of this variable is returned. Next, each directory listed in search_paths is searched. If the executable could still not be found and search_system_paths is set to True, the binary search paths are searched.

If the file could not be located, a FileNotFound exception will be raised containing a detail description why Locate failed. The error message is formatted in such a way that it can directly be presented to the user.

Search

Enter search terms or a module, class or function name.

Contents

Documentation is available for the following OpenStructure versions:

dev / 2.9.0 / 2.8 / (Currently viewing 2.7) / 2.6 / 2.5 / 2.4 / 2.3.1 / 2.3 / 2.2 / 2.1 / 2.0 / 1.9 / 1.8 / 1.7.1 / 1.7 / 1.6 / 1.5 / 1.4 / 1.3 / 1.2 / 1.11 / 1.10 / 1.1

This documentation is still under heavy development!
If something is missing or if you need the C++ API description in doxygen style, check our old documentation for further information.