PyABM uses the python
logging module, so that
warning and informational messages from the PyABM module can be written to the
console, and also saved to files along with model output. For flexibility, and
consistent with recommended usage of the logging module, configuration of the
logging output is left up to the user of PyABM. If you import pyabm
directly
from a python session without setting up logging first, you will see a warning
message when PyABM tries to log a message:
For this example, I have forced PyABM to try to print an error message, by
specifying the wrong path to git in my pyabmrc. To see the error message, I
will need to import logging
and configure a logging handler prior to
importing PyABM:
I now see a warning telling me that /wrong/path/to/git
does not exist, and
PyABM tries the default path to git specified in rcparams.default. This path
also does not exist (as I am running this example on Linux and PyABM is setup
for Windows by default) so I then see another warning ‘git version control
features disabled’ as PyABM is not able to find git. If I fix my pyabmrc file
to give the correct path to git (which, on my system, is /usr/bin/git
) I can
import pyabm
without seeing any error messages: