2. Environment setup

There exists two directories that are scanned by cssed's python plugins on startup. Those directories serves to various purposes.

Those directories are defined at compile time, and may vary among different systems. One is for system wide scripts and libraries, and is located at cssed's library directory at $PREFIX/lib/cssedon the "python" directory. The other is for user defined scripts and libraries and it's located at $HOME/.cssed/pythonscripts.

As example in my system, with default prefix - /usr/local - the system wide scripts and library directory is /usr/local/lib/cssed/python and the user scripts directory is at /home/iago/.cssed/pythonscripts.

There exists functions in the API to deal with those directories to avoid to hard-code them on scripts and to make scripts more portable. Those functions are get_user_python_directory() and get_global_python_directory(). The first returns the user python directory - from cssed's point of view - and the later returns the cssed's system-wide python directory.

To setup a custom environment for your scripting, the plugin will run a script called __pycssedinit__.py - if it exists - located at your user scripts directory. You can put here all initialization code needed to fit your needs. If the script does not exists, nothing will be done.

You can know where is this file stored on your system running the following python script.

import cssed


This feature can be disabled at compile time. In such case cssed.interpreter_init_script() will return None.