Location Class

Inheritance diagram of Location

class Location

Abstract resource location.

Given a location, a file can be loaded from that location with the open method. This provides a convenient way to specify a path to load files from, and not necessarily have that path reside on the filesystem.

Methods:

open(filename[, mode]) Open a file at this location.

Methods

Location.open(filename, mode='rb')

Open a file at this location.

Parameters:
  • filename (str) – The filename to open. Absolute paths are not supported. Relative paths are not supported by most locations (you should specify only a filename with no path component).
  • mode (str) – The file mode to open with. Only files opened on the filesystem make use of this parameter; others ignore it.
Return type:

file object

Table Of Contents

Previous topic

Loader Class

Next topic

URLLocation Class