Nick,
Attached is an updated version of the mospy script. In your newly released implementation, if PYTHONPATH was not already set, the mospy fails because PYTHONPATH is not a variable. The way it was program you cant set the path without it already existing.
This version handles that condition by putting the if statement ahead of the envar definition and is identical to what I sent to you earlier.
Marc