import os1import logging2import traceback3import subprocess45#logging.basicConfig(level=logging.DEBUG, filename='errors.log')6logf = open("errors.log", "w")78root = '/Users/kpmurphy/github/pyprobml/scripts'9filenames = ['linreg_poly_vs_degree.py', 'linreg_contours_sse_plot.py', 'linregOnlineDemo.py']1011for f in filenames:12python = 'python3'13#python = '/opt/anaconda3/envs/spyder-dev/bin/python'14cmd = f'{python} {root}/{f}'1516print('\n\n', cmd)17try:18os.system(cmd)19#subprocess.run([cmd], check=True)20except Exception as e:21err = f'Failed to run {f}: {e}'22print('******\n', err)23logf.write(err)24traceback.print_exc(file=logf)25#logging.exception(err)26pass2728