def ejectCdrom(device): fd = os.open(device, os.O_RDONLY | os.O_NONBLOCK) # this is a best effort try: _isys.ejectcdrom(fd) except SystemError, e: log.warning("error ejecting cdrom (%s): %s" % (device, e)) pass
def ejectCdrom(device, makeDevice = 1): if makeDevice: makeDevInode(device, "/tmp/cdrom") fd = os.open("/tmp/cdrom", os.O_RDONLY|os.O_NONBLOCK) else: fd = os.open(device, os.O_RDONLY|os.O_NONBLOCK) # this is a best effort try: _isys.ejectcdrom(fd) except SystemError, e: log.warning("error ejecting cdrom (%s): %s" %(device, e)) pass