1. File Structure

The API is based on Python version 3.2.2 (http://python.org/). It is supplied in a bundle with Cerebro client application (https://cerebrohq.com/).

Also, distribution pack includes following third-party packages:

The API files are stored in py-frontend folder. Python and the third-party packages are stored in py-site-packages folder. Both folders are located next to the Cerebro executable file.

Note

For Mac OS X these folders may be stored either inside the Cerebro.app (Cerebro.app/Contents/MacOs/) container, or next to it. First, check the folders next to the Cerebro.app container. It is done for the sake of convenience in case you have a centralized server storage of Python modules in a multi-OS environment. That is, if you have Cerebro executable files for all operating systems next to each other, in the same folder, the subfolders for Python modules will be inside this folder as well, as a single copy, without unnecessary duplication.

The py-frontend folder contains extension module templates, cerebro package and a number of examples examples.

Cerebro Python API file structure on a HDD:

Cerebro/

    cerebro

    py-frontend/
        examples/
            ...
        cerebro/
            ...
        event.py.template
        logoff.py.template
        logon.py.template
        menu.py.template

    py-site-packages/
        linux32/
            ...
        linux64/
            ...
        mac/
            ...
        psycopg2/
            ...
        win/
            ...
        html2text.py
        python32.zip
        xlrd3.zip
        xlwt3.zip

    ...

1.1. Where the application looks for user-written modules

User-made packages and modules are being searched for by default:

  • in a root directory, next to a Cerebro executable file;
  • in the py-frontend folder;
  • in the py-site-packages folder;
  • in the py-site-packages/linux32, py-site-packages/linux64, py-site-packages/mac and py-site-packages/win folders depending on the operating system.

All the search paths are contained in the sys.path variable. You can add additional search paths there. Please note that it should be done before you import the package/module located there.