. Advertisement .
..3..
. Advertisement .
..4..
I got the warning “oserror: [winerror 10038] an operation was attempted on something that is not a socket” with my method impacted by the original code (version 9.76.01) below:
def run(self):
try:
buf = b""
while self.conn.isConnected():
data = self.conn.recvMsg()
logger.debug("reader loop, recvd size %d", len(data))
buf += data
while len(buf) > 0:
(size, msg, buf) = comm.read_msg(buf)
#logger.debug("resp %s", buf.decode('ascii'))
logger.debug("size:%d msg.size:%d msg:|%s| buf:%s|", size,
len(msg), buf, "|")
if msg:
self.msg_queue.put(msg)
else:
logger.debug("more incoming packet(s) are needed ")
break
logger.debug("EReader thread finished")
except:
logger.exception('unhandled exception in EReader thread')
I don’t know the reason that occurs this issue. Please help me fix it as soon as possible.
Thanks a lot. I really appreciate you guys’ support.
The cause:
On Windows Python, you get the error while executing InteractiveBrokers API’s disconnect():
The Interactive Brokers API class has a mistake that is the cause of oserror: [winerror 10038] an operation was attempted on something that is not a socket problem.
Solution: Change C:\TWS API\source\pythonclient\ibapi\reader.py and install new to resolve the issue and prevent an error from being unnecessarily raised:
To resolve the issue, substitute this code: