Add environment variable encoding stuff from pubsub branch to try to work around Python 3 issue with DRMAA.
Work around Python 3 issue with subprocess.stdin only accepting bytes.