gnome.scripting.utilities

utilities for scripting gnome

assorted utilities that make it easier to write scripts to automate gnome

designed to be imported into the package __init__.py

remember to add anyting new you want imported to “__all__”

Module Contents

Classes

PrintFinder

class to capture stdout so that you can find print statements

Functions

make_images_dir([images_dir])

Create output directory for rendered images.

remove_netcdf(netcdf_file)

remove netcdf_file and associated uncertain netcdf file

set_verbose([log_level])

Set the logging system to dump to the console --

gnome.scripting.utilities.make_images_dir(images_dir=None)

Create output directory for rendered images. If it already exists, delete all old output files

gnome.scripting.utilities.remove_netcdf(netcdf_file)

remove netcdf_file and associated uncertain netcdf file

Give scripts control over deleting the netcdf file before instantiating a new NetCDFOutput object.

gnome.scripting.utilities.set_verbose(log_level='info')

Set the logging system to dump to the console – you can see much more what’s going on with the model as it runs

Parameters:

log_level='info' – the level you want your log to show. options are, in order of importance: “debug”, “info”, “warning”, “error”, “critical”.

You will only get the logging messages at or above the level you set. Set to “debug” for everything.

class gnome.scripting.utilities.PrintFinder

Bases: object

class to capture stdout so that you can find print statements

This will print the file, line number, and line after a print statement

To use, simply create an instance in your script

PrintFinder()

IF you want to be able to put it back, save it and call:

pf = PrintFinder()

pf.restore()

initialize a PrintFinder object

This captures stdout when it is initialized

write(content)

The stream write method – intercepts the write to stdout, writes to original stdout, then adds some traceback info.

restore()

sets stdout back to the original

flush()

forwards a flush call on to the original stdout