Hi,
I am writing a serial port communication application using Iron Python.
Following is a sample code:
try:
BaudRate = 9600
DataBits = 8
#create a serial port instance for the desired port as specified
serialPort = System.IO.Ports.SerialPort( "COM1")
serialPort.BaudRate = BaudRate
serialPort.DataBits = DataBits
#open the port
serialPort.Close()
serialPort.Open()
serialPort.ReadTimeout = 30000
returnValue = serialPort.ReadTo( "xx" )
except:
print "error"
returnValue = ""
serialPort.Close()
serialPort.Dispose()
Here if i abort my application using Cntrl + C on the iron python console,
then i get ObjectDisposedException unhandled though i have provided an
exception handler.
I tried to abort the application while it was waiting for some data to be
read and the timeout had not occured. The application exits and I get the
exception after it exits.
Stack Trace:
at Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
at System.Threading.EventWaitHandle.Set()
at System.IO.Ports.SerialStream.AsyncFSCallback(UInt32 errorCode,
UInt32 numBytes, NativeOverlapped* pOverlapped)
at
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32
errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
Please let me know what can be the issue.
Thanks & regards,
Sheetal
_____________________________________________________________________________________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com