connectors/PYRO/__init__.py
changeset 477 f66a092b6e74
parent 465 67d32a91d70b
child 486 2e0fe44044b3
equal deleted inserted replaced
476:92f449479084 477:f66a092b6e74
    18 #You should have received a copy of the GNU General Public
    18 #You should have received a copy of the GNU General Public
    19 #License along with this library; if not, write to the Free Software
    19 #License along with this library; if not, write to the Free Software
    20 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    20 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 import Pyro.core as pyro
    21 import Pyro.core as pyro
    22 from Pyro.errors import PyroError
    22 from Pyro.errors import PyroError
       
    23 import Pyro.util
    23 import traceback
    24 import traceback
    24 from time import sleep
    25 from time import sleep
    25 import copy
    26 import copy
    26 
    27 
    27 # this module attribute contains a list of DNS-SD (Zeroconf) service types
    28 # this module attribute contains a list of DNS-SD (Zeroconf) service types
    53         and return defaul value when it happen
    54         and return defaul value when it happen
    54         """
    55         """
    55         def catcher_func(*args,**kwargs):
    56         def catcher_func(*args,**kwargs):
    56             try:
    57             try:
    57                 return func(*args,**kwargs)
    58                 return func(*args,**kwargs)
    58             except PyroError,e:
    59             except Exception,e:
    59                 #pluginsroot.logger.write_error(traceback.format_exc())
    60                 #pluginsroot.logger.write_error(traceback.format_exc())
    60                 pluginsroot.logger.write_error(str(e)+"\n")
    61                 errmess = ''.join(Pyro.util.getPyroTraceback(e))
       
    62                 pluginsroot.logger.write_error(errmess+"\n")
       
    63                 print errmess
    61                 pluginsroot._connector = None
    64                 pluginsroot._connector = None
    62                 return default
    65                 return default
    63         return catcher_func
    66         return catcher_func
    64 
    67 
    65     # Check connection is effective. 
    68     # Check connection is effective.