Guys I am trying to create a application to create training data
The error in the line pickle_out = open(X.pickle,'wb') is that the name of file must be in quotes. So the correct code would be:

pickle_out = open('X.pickle','wb')
pickle.dump(X,pickle_out)
pickle_out.close()


Do the same for Y also. Also you can do it more concisely in the following way:

with open('X.pickle', 'wb') as f:
    pickle.dump(X, f)