def _open(file_name, mode): import os file_name = os.path.expanduser(file_name) from libtbx.str_utils import show_string from libtbx import smart_open try: return smart_open.file(file_name=file_name, mode=mode) except IOError, e: raise IOError("Cannot open pickle file %s (%s)" % ( show_string(file_name), str(e)))
def _open(file_name, mode): import os file_name = os.path.expanduser(file_name) from libtbx.str_utils import show_string from libtbx import smart_open try: return smart_open.file(file_name=file_name, mode=mode) except IOError, e: raise IOError("Cannot open pickle file %s (%s)" % (show_string(file_name), str(e)))
def _open(file_name, mode): """ Wraps libtbx.smart_open. Parameters ---------- file_name : str mode : str Returns ------- file """ file_name = os.path.expanduser(file_name) try: return smart_open.file(file_name=file_name, mode=mode) except IOError as e: raise IOError("Cannot open pickle file %s (%s)" % ( show_string(file_name), str(e)))
def _open(file_name, mode): """ Wraps libtbx.smart_open. Parameters ---------- file_name : str mode : str Returns ------- file """ import os file_name = os.path.expanduser(file_name) from libtbx.str_utils import show_string from libtbx import smart_open try: return smart_open.file(file_name=file_name, mode=mode) except IOError as e: raise IOError("Cannot open pickle file %s (%s)" % ( show_string(file_name), str(e)))