You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Michael Robellard (JIRA)" <ji...@apache.org> on 2009/05/10 18:44:45 UTC

[jira] Updated: (THRIFT-495) If you inadvertently try to send without first opening you get a useless exception

     [ https://issues.apache.org/jira/browse/THRIFT-495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Robellard updated THRIFT-495:
-------------------------------------

    Patch Info: [Patch Available]

Index: TSocket.py
===================================================================
--- TSocket.py  (revision 773121)
+++ TSocket.py  (working copy)
@@ -95,6 +95,8 @@
     return buff

   def write(self, buff):
+    if not self.handle:
+      raise socket.error('Client not Connected')
     sent = 0
     have = len(buff)
     while sent < have:


> If you inadvertently try to send without first opening you get a useless exception
> ----------------------------------------------------------------------------------
>
>                 Key: THRIFT-495
>                 URL: https://issues.apache.org/jira/browse/THRIFT-495
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Python)
>         Environment: Debian x86 linux running hbase, hadoop, Python2.5.4, thrift trunk
>            Reporter: Michael Robellard
>            Priority: Trivial
>
> When you accidentally try and cause a send when you don't call open first you get an AttributeError: 'NoneType' object has no attribute 'send'
> Complete traceback:
> AttributeError                            Traceback (most recent call last)
> /home/dramus/code/wade/wade/model/<ipython console> in <module>()
> /home/dramus/code/wade/wade/model/hbasemodel.py in CreateTable(self)
>      30
>      31         try:
> ---> 32             self.client.createTable("node", columns)
>      33         except ttypes.AlreadyExists, ex:
>      34             log.exception(ex.message)
> /home/dramus/code/wade/wade/model/hbase/Hbase.py in createTable(self, tableName, columnFamilies)
>     723      - columnFamilies
>     724     """
> --> 725     self.send_createTable(tableName, columnFamilies)
>     726     self.recv_createTable()
>     727
> /home/dramus/code/wade/wade/model/hbase/Hbase.py in send_createTable(self, tableName, columnFamilies)
>     733     args.write(self._oprot)
>     734     self._oprot.writeMessageEnd()
> --> 735     self._oprot.trans.flush()
>     736
>     737   def recv_createTable(self, ):
> /home/dramus/code/wade/wade/model/usr/lib/python2.5/site-packages/thrift/transport/TTransport.py in flush(self)
> /home/dramus/code/wade/wade/model/usr/lib/python2.5/site-packages/thrift/transport/TSocket.py in write(self, buff)
> AttributeError: 'NoneType' object has no attribute 'send'
> A more appropriate error message would be to raise a NotConnectedError or something along those lines

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.