AJ | Pact | logo
PACT
Prism Fission

Prism Fission

9 September 2017

CreativePact (32 posts)

In this CreativePact, following a couple of months in the creative doldrums, I will be working to complete Prism Exhilarated, a unique media music release by ‑otron.

Prism in Python - config parsing

13/09/17
AJ Pact | Prism Fission | Prism in Python - config parsing

Following on from setting up the *Prism Exhilarated* Python project a few days ago, today I spent some time developing a routine to parse the configuration file that underpins the album.

This file will contain all the vital information the script needs to construct the album, from release information, to location of assets, to the details of each unique process. Likely I will tweak it some more in the coming weeks, but it's mainly there.

Having had some experience with the format in the past (especially in my dealings with Grav CMS), I decided to go with YAML as my data storage format. The indentation-strong layout is Pythonic in nature and I find it easier to read than JSON. (What's that? XML?? Get outta here!)

Also, a solid YAML module was not far away: PyYAML is long-lived and easy to install via pip. Once installed, parsing the config file was as simple as loading the contents of the file and running yaml.load() on it.