Python errno.ESPIPE Examples
The following are 8
code examples of errno.ESPIPE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
errno
, or try the search function
.
Example #1
Source File: input.py From Yuki-Chan-The-Auto-Pentest with MIT License | 6 votes |
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))
Example #2
Source File: input.py From ITWSV with MIT License | 6 votes |
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))
Example #3
Source File: input.py From EasY_HaCk with Apache License 2.0 | 6 votes |
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))
Example #4
Source File: configure.py From f5-openstack-agent with Apache License 2.0 | 5 votes |
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))
Example #5
Source File: tailbot.py From abusehelper with MIT License | 5 votes |
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
Example #6
Source File: study_file.py From Python-notes with MIT License | 5 votes |
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
Example #7
Source File: linux.py From manticore with GNU Affero General Public License v3.0 | 5 votes |
def seek(self, offset: int, whence: int = os.SEEK_SET): raise FdError("Invalid write() operation on SocketDesc", errno.ESPIPE) # EINVAL? EBADF?
Example #8
Source File: linux.py From manticore with GNU Affero General Public License v3.0 | 5 votes |
def seek(self, offset: int, whence: int = os.SEEK_SET) -> int: raise FdError("Invalid lseek() operation on Socket", errno.ESPIPE)