MCPcopy Create free account
hub / github.com/ActiveState/code / close

Method close

recipes/Python/180919_Windows_CDRom_Module/recipe-180919.py:80–87  ·  view source on GitHub ↗

Closes the cd drive door.

(self, drive='')

Source from the content-addressed store, hash-verified

78 win32file.CloseHandle(hdevice)
79
80 def close(self, drive=''):
81 '''Closes the cd drive door.'''
82 drive = drive or self.drive
83 device = self.__getDeviceHandle(drive)
84 hdevice = win32file.CreateFile(device, GENERIC_READ,
85 FILE_SHARE_READ, None, OPEN_EXISTING, 0, 0)
86 win32file.DeviceIoControl(hdevice,2967564,"", 0, None)
87 win32file.CloseHandle(hdevice)
88
89if __name__ == '__main__':
90 cd = Cdrom(timeout=5)

Callers 15

checkFilesMethod · 0.45
convertMethod · 0.45
recipe-104733.pyFile · 0.45
genIndexFunction · 0.45
recipe-189060.pyFile · 0.45
printfileFunction · 0.45
bookEntryFunction · 0.45
saveFunction · 0.45
loadFunction · 0.45
mainFunction · 0.45
process_mailboxFunction · 0.45
recipe-186101.pyFile · 0.45

Calls 1

__getDeviceHandleMethod · 0.95

Tested by

no test coverage detected