print statement not appearing in terminal
Question: I'm starting to play with scikit-learn after enjoying my AI class last
semester. I have no prior experience with python (we used WEKA) so I set up
python3 with a virtual env that has all the packages. I've activated the
virtual env and try running the below code via `python3 <filename.py>`

from sklearn import svm, datasets from numpy import genfromtxt, savetxt import
sys

    
    
    def main():
        digits = datasets.load_digits()
        clf = svm.SVC(gamma=0.001, C=100.)
        clf.fit(digits.data[:-1], digits.target[:-1])  
        SVC(C=100.0, cache_size=200, class_weight=None, coef0=0.0, degree=3,
        gamma=0.001, kernel='rbf', max_iter=-1, probability=False,
        random_state=None, shrinking=True, tol=0.001, verbose=False)
        print(clf.predict(digits.data[-1]))
        sys.stdout.flush()
    

which prints nothing to iterm (a mac os x bash terminal). So tried running
this code

    
    
    def main():
        print("hi", end='\n', file=sys.stdout, flush=True)
    

which also prints nothing. I've looked at the print documentation and asked a
friend (who's only used 2.7) without figuring this out


Answer: Does your main() function ever get called? Try adding this to the end of your
module.

    
    
    if __name__=="__main__":
        main()
    

