import stat import os def disk_exists(path): try: return stat.S_ISBLK(os.stat(path).st_mode) except: return False