Hi all,
I am trying to use pySerial to connect to a USB over Serial device. Using,
USB
monitoring tool, I see that I am able to connect to the port. I could also
read
data relayed by the device. However, any write on the com port handle is
throwing
Windows Error 2, The system cannot find the file specified"
I am working with pySerial 2.5, Python 2.7 on Windows XP Prof. SP2
Any idea why the write is failing? Any help much appreciated.
Regards,
Sridev
--------------------Code------------------------------
import serial
try:
port = serial.Serial('\\\\.\\COM10',timeout=2)
print "Successfully opened the com port."
print port
except:
print "Failed to initialize com port"
print port.write("020200013803")
---------------Code---------------------------------------
----------------Output------------------------------------
Serial<id=0xf47890, open=True>(port='\\\\.\\COM10', baudrate=9600,
bytesize=8, p
arity='N', stopbits=1, timeout=2, xonxoff=0, rtscts=0, dsrdtr=0)
WriteFile failed, 2: The system cannot find the file specified
------------------Output----------------------------------
On digging into serialwin32.py line
>>err = win32.WriteFile(self.hComPort, data, len(data), ctypes.byref(n),
self._overlappedWrite)
I see that self.hComPort = 1948 which is the valid handle created while
opening
the port.
_______________________________________________
Tutor maillist - Tut...@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor