Komnomnomnom / swigibpy

Third party Interactive Brokers Python API generated from TWS C++ API using SWIG.
http://github.com/Komnomnomnom/swigibpy/
Other
158 stars 35 forks source link

Exception in run - swigibpy.py (version: 0.5.0) #36

Closed mwahal closed 9 years ago

mwahal commented 9 years ago

Hi

From the setup.py file

IB_DIR = 'IB'

VERSION = '0.5.0'

I am occasionally get an exception in run method. Here is the exception,

Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
  File "/usr/local/lib/python2.7/dist-packages/swigibpy-0.5.0-py2.7-linux-x86_64.egg/swigibpy.py", line 2076, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'

Here is the code

2072
2073             if fd > 0:
2074                 try:
2075                     evtin, evtout, evterr = select.select(pollfd, pollfd, pollfd, 1)
2076                 except select.error:
2077                     connected.clear()
2078                     continue
Komnomnomnom commented 9 years ago

hi @mwahal when does this occur? At shutdown / startup or in the middle of the execution of your program?

mwahal commented 9 years ago

Hi .. Most of the time at shutdown, because I see that the IB transactions have finished (such as get execution reports etc).

Thanks Mudit

Komnomnomnom commented 9 years ago

thanks @mwahal this looks like a well known issue caused by the Python interpeter clearing the module globals during shutdown before the thread has finished executing.

Although the error is safe to ignore I've just pushed some code to suppress it (68ba32f9622177b663bc0d370eaea900e7bf621f) to the master branch, could you try it out and let me know how it goes?

mwahal commented 9 years ago

I have patched both files, will let you know if I see them again.

mwahal commented 9 years ago

I have not seen the issue again. You can close this ddts now.

Komnomnomnom commented 9 years ago

Great thanks for the feedback