Table Of Contents

Previous topic

music21.editorial

Next topic

music21.expressions

This Page

music21.environment

Environment

class music21.environment.Environment(modName=None)

The Environment object stores user preferences as dictionary-like object.

Create an instance of this object. A modName argument can be provided for use in printDebug() calls.

>>> a = Environment()
>>> post = a['writeFormat']

Environment attributes

modNameParent
A string representation of the module that contains this Environment instance.
ref
The Python dictionary used to store all internal settings.

Environment methods

read(fp=None)
Load from an XML preference file if and only if available and has been written in the past. This means that no preference file will ever be written unless manually done so.
write(fp=None)
Write an XML file. This must be manually called to store preferences. If fp is None, the default storage location will be used.
getSettingsPath()
Return the path to the platform specific settings file.
getTempDir()
Get a temporary directory. Return the user preference if set.
getTempFile(suffix=)
Return a file path to a temporary file with the specified suffix
keys()
No documentation.
launch(fmt, fp, options=)
Open a file with an either default or user-specified applications.
loadDefaults()
Load defaults. All keys are derived from these defaults.
printDebug(msg, statusLevel=1)
Format one or more data elements into string, and print to stderr. The first arg can be a list of string; lists are concatenated with common.formatStr().
warn(msg)
To print a warning to the user, send a list of strings to this method.

Preference

class music21.environment.Preference
>>> a = Preference()

inherits from: Node

Settings

class music21.environment.Settings
>>> a = Settings()

inherits from: NodeList, Node