If not err and win32.GetLastError() != win32.ERROR_IO_PENDING: #~ win32event.ResetEvent(self._overlappedWrite.hEvent)Įrr = win32.WriteFile(self.hComPort, data, len(data), ref(n), self._overlappedWrite) # convert data (needed in case of memoryview instance: Py 3.1 io lib), ctypes doesn't like memoryview #~ raise TypeError('expected %s or bytearray, got %s' % (bytes, type(data))) #~ if not isinstance(data, (bytes, bytearray)): If not self.hComPort: raise portNotOpenError """Output the given string over the serial port.""" The source code for writing in pyserial looks very simple def write(self, data): What happens here? Sounds like a bug in either pyserial or ctypes. When using a similar program using a c library, the same port responds correctly. SerialException: ReadFile failed ( The handle is invalid.) Raise SerialException("ReadFile failed (%s)" % ctypes.WinError()) ser = serial.Serial(3,115200,timeout=1)įile "build\bdist.win-amd64\egg\serial\serialwin32.py", line 236, in read I'm on windows 7 64 bit, with python 2.6, and it's giving me the same error.
0 Comments
Leave a Reply. |