title: Python Hive: thrift.transport.TTransport.TTransportException: None
body: <p>Suppose Hive is installed in say, "g" cluster. I do not have access to the Gold Cluster. I'm doing my python development work in "s" cluster. I can access Hive from the "s" cluster and run queries.</p>
  
  <p>I have the below code to connect to Hive from a Python script running in "s" cluster. </p>
  
  <p><code>some_table</code> is a table that already exists in Hive. I would like to execute a simple <code>select * from some_table</code> command to get some results.</p>
  
  <pre><code>import sys
  sys.path.append("/usr/lib/hive/lib/py")
  
  from hive_service import ThriftHive
  from hive_service.ttypes import HiveServerException
  from thrift import Thrift
  from thrift.transport import TSocket
  from thrift.transport import TTransport
  from thrift.protocol import TBinaryProtocol
  
  
  transport = TSocket.TSocket('what-ever-server', what-ever-port)
  transport = TTransport.TBufferedTransport(transport)
  protocol = TBinaryProtocol.TBinaryProtocol(transport)
  
  client = ThriftHive.Client(protocol)
  transport.open()
  print "connect success"
  client.execute("SELECT * FROM some_table")
  print client.fetchAll()
  print "executed"
  </code></pre>
  
  <p>But I get the below error after "connect success" is printed. I am assuming that the connection was successful.</p>
  
  <pre><code>Traceback (most recent call last):
     File "hiveConnect.py", line 30, in &lt;module&gt;
        row = client.execute("SELECT * FROM some_table")
     File "/usr/lib/hive/lib/py/hive_service/ThriftHive.py", line 68, in execute
        self.recv_execute()
     File "/usr/lib/hive/lib/py/hive_service/ThriftHive.py", line 79, in recv_execute
         (fname, mtype, rseqid) = self._iprot.readMessageBegin()
     File "/usr/lib/hive/lib/py/thrift/protocol/TBinaryProtocol.py", line 137, in readMessageBegin
         name = self.trans.readAll(sz)
     File "/usr/lib/hive/lib/py/thrift/transport/TTransport.py", line 58, in readAll
          chunk = self.read(sz-have)
     File "/usr/lib/hive/lib/py/thrift/transport/TTransport.py", line 155, in read
          self.__rbuf = StringIO(self.__trans.read(max(sz, self.DEFAULT_BUFFER)))
     File "/usr/lib/hive/lib/py/thrift/transport/TSocket.py", line 94, in read
          raise TTransportException('TSocket read 0 bytes')
  thrift.transport.TTransport.TTransportException: None
  </code></pre>
  
  <p>What am I doing wrong in this code? I am not experiencing any error while connecting to Hive using the server-name and port, so I'm assuming everything is fine there and that the connection to Hive is not the issue.</p>