use subprocess module in preview.py instead of os.system