def opencom1(): # returns a handle to the Windows file return win32file.CreateFile(u'COM1:', win32file.GENERIC_READ, \ 0, None, win32file.OPEN_EXISTING, 0, None)