Fixed errors in python script and tested with latest Spark 1.0.2