mycroft.filesystem

class mycroft.filesystem.FileSystemAccess(path)[source]

A class for providing access to the mycroft FS sandbox.

Intended to be attached to skills at initialization time to provide a skill-specific namespace.

exists(filename)[source]

Check if file exists in the namespace.

Parameters

filename (str) – a path relative to the namespace. subdirs not currently supported.

Returns

True if file exists, else False.

Return type

bool

open(filename, mode)[source]

Open a file in the provided namespace.

Get a handle to a file (with the provided mode) within the skill-specific namespace.

Parameters
  • filename (str) – a path relative to the namespace. subdirs not currently supported.

  • mode (str) – a file handle mode

Returns

an open file handle.

path

Member value containing the root path of the namespace