Fixed python codec to deal with environment references.