Closed buckie closed 9 years ago
If the QConnection attributes are bad (i.e. the q server isn't up or the port number is wrong) it's handled incorrectly. Should only take an error catch in https://github.com/exxeleron/qPython/blob/master/qpython/qconnection.py#L115-L119 to fix the issue.
# kdb is running on port 5000 In [1]: from qpython import qconnection In [2]: q = qconnection.QConnection('localhost', 5000) In [3]: q.open() In [4]: q.is_connected() Out[4]: True In [5]: q = qconnection.QConnection('localhost', 6000) In [6]: q.open() --------------------------------------------------------------------------- error Traceback (most recent call last) <ipython-input-6-486c86d6f873> in <module>() ----> 1 q.open() /Users/wjm/repos/qPython/qpython/qconnection.pyc in open(self) 106 raise QConnectionException('Host cannot be None') 107 --> 108 self._init_socket() 109 self._initialize() 110 /Users/wjm/repos/qPython/qpython/qconnection.pyc in _init_socket(self) 116 '''Initialises the socket used for communicating with a q service,''' 117 self._connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) --> 118 self._connection.connect((self.host, self.port)) 119 self._connection.settimeout(self.timeout) 120 /Users/wjm/anaconda/envs/flask-kdb/lib/python2.7/socket.pyc in meth(name, self, *args) 222 223 def meth(name,self,*args): --> 224 return getattr(self._sock,name)(*args) 225 226 for _m in _socketmethods: error: [Errno 61] Connection refused In [7]: q.is_connected() Out[7]: True
If the QConnection attributes are bad (i.e. the q server isn't up or the port number is wrong) it's handled incorrectly. Should only take an error catch in https://github.com/exxeleron/qPython/blob/master/qpython/qconnection.py#L115-L119 to fix the issue.