Swap order of chdir and python blocks; put the python block on the outside.