Python Invalid Index To Scalar Variable