I used this code almost exactly, just changing the line:
f = gzip.open("../data/mnist.pkl.gz", \'rb\') training_data, validation_data, test_data = c