player = DEFAULT_PLAYER # popen will decide where to put output, and there is not # standard form of NUL system = platform.system() if system == 'Linux': nulname = '/dev/null' elif system == 'Windows': nulname = 'NUL' else: raise Exception('Unsupported operating system: \'' + system + '\'') FNUL = open(nulname, 'w') exists, the_files = files.list( os.getcwd(), exts=music_exts, files=1, dirs=0, fulltree=1) if exists: subprocess.Popen([player]+the_files, stdout=FNUL, stderr=FNUL)