当前位置: 首页>>代码示例>>Python>>正文


Python errno.ESPIPE属性代码示例

本文整理汇总了Python中errno.ESPIPE属性的典型用法代码示例。如果您正苦于以下问题:Python errno.ESPIPE属性的具体用法?Python errno.ESPIPE怎么用?Python errno.ESPIPE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在errno的用法示例。


在下文中一共展示了errno.ESPIPE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESPIPE [as 别名]
def __init__(self, input, size=None, **args):
        if not hasattr(input, "seek"):
            if size is None:
                input = InputPipe(input, self._setSize)
            else:
                input = InputPipe(input)
        elif size is None:
            try:
                input.seek(0, 2)
                size = input.tell() * 8
            except IOError, err:
                if err.errno == ESPIPE:
                    input = InputPipe(input, self._setSize)
                else:
                    charset = getTerminalCharset()
                    errmsg = unicode(str(err), charset)
                    source = args.get("source", "<inputio:%r>" % input)
                    raise InputStreamError(_("Unable to get size of %s: %s") % (source, errmsg)) 
开发者ID:Yukinoshita47,项目名称:Yuki-Chan-The-Auto-Pentest,代码行数:20,代码来源:input.py

示例2: exit_cleanly

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESPIPE [as 别名]
def exit_cleanly(errnum=None):
    """exit_cleanly

Exits the runtime cleanly using SystemExit.  This is the official, handling
exception here as this is mostly meant to be a standalone script.
    """
    default = "An Unknown Error has Occurred!"
    cases = {errno.EINVAL: "Improper or invalid input value",
             errno.ESPIPE: "Could not complete action due to a broken" +
             " dependency",
             errno.ENOSYS: "Could not complete action due to unexpected setup",
             errno.EIO: "Could not access an expected file",
             errno.EPERM: "Could not access an item due to permissions issues",
             -1: default}
    help_stmt = """
%s [--opt [option]]
    With opts:
        working_directory - ONLY use this if you're overwriting `pwd`!
    """ % (sys.argv[0])
    if not errnum:
        errnum = 0
    elif not isinstance(errnum, int) and hasattr(errno, errnum):
        errnum = getattr(errno, errnum)
    try:
        errnum = int(errnum)
    except TypeError:
        errnum = -1
    if errnum == 0:
        help_stmt = ''
        stmt = "Successful in configuration!"
    elif errnum in cases:
        stmt = cases[errnum]
    else:
        stmt = default
    print("%s\n\n%s" % (stmt, help_stmt)) 
开发者ID:F5Networks,项目名称:f5-openstack-agent,代码行数:37,代码来源:configure.py

示例3: try_seek

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESPIPE [as 别名]
def try_seek(fd, offset):
    try:
        if offset is None:
            os.lseek(fd, 0, os.SEEK_END)
        elif offset >= 0:
            os.lseek(fd, offset, os.SEEK_SET)
        else:
            os.lseek(fd, offset, os.SEEK_END)
    except OSError as ose:
        if ose.args[0] != errno.ESPIPE:
            raise 
开发者ID:abusesa,项目名称:abusehelper,代码行数:13,代码来源:tailbot.py

示例4: get_file_size

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESPIPE [as 别名]
def get_file_size(file_obj):

    if (hasattr(file_obj, 'seek') and hasattr(file_obj, 'tell') and
            (six.PY2 or six.PY3 and file_obj.seekable())):
        try:
            curr = file_obj.tell()
            file_obj.seek(0, os.SEEK_END)
            size = file_obj.tell()
            file_obj.seek(curr)
            return size
        except IOError as e:
            if e.errno == errno.ESPIPE:
                return
            else:
                raise 
开发者ID:tomoncle,项目名称:Python-notes,代码行数:17,代码来源:study_file.py

示例5: seek

# 需要导入模块: import errno [as 别名]
# 或者: from errno import ESPIPE [as 别名]
def seek(self, offset: int, whence: int = os.SEEK_SET):
        raise FdError("Invalid write() operation on SocketDesc", errno.ESPIPE)  # EINVAL?  EBADF? 
开发者ID:trailofbits,项目名称:manticore,代码行数:4,代码来源:linux.py


注:本文中的errno.ESPIPE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。