udacity / ud120-projects

Starter project code for students taking Udacity ud120
1.62k stars 5.66k forks source link

No module named "feature_format" #147

Open bhandari-nitin opened 6 years ago

bhandari-nitin commented 6 years ago

The code under k_means throws an error saying "No module named feature_format". Is feature_format module deprecated in newer versions of python?

alij commented 6 years ago

It looks like the feature_format.py file is in the tools directory and not a builtin module. I had to hard code the path in the line number 14 of the k_means_cluster.py like so: sys.path.append("C:/ud120-projects/tools/")

I also had to hardcode the path on line 42 to make it work: data_dict = pickle.load( open("C:/ud120-projects/final_project/final_project_dataset.pkl", "r") )

martymc21 commented 6 years ago

@alij thank you

shishirx34 commented 6 years ago

On windows with python version 3.6, the file should be read in binary and the dataset.pkl needs to be encoded into unix style line endings from DOS style, see the details in this stack overflow on how to do it.

with open("E:/Udacity/ud120-projects/final_project/final_project_dataset_unix.pkl", "rb") as f:
    data_dict = pickle.load(f)