Python errno 模块,EROFS 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用errno.EROFS

项目:kinect-2-libras    作者:inessadl    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except IOError, e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False   # No changes require rewriting the file.
        self._locked = False
        self._file_length = None        # Used to record mailbox size
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except IOError, e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None    # Used to record mailbox size
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except IOError as e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False   # No changes require rewriting the file.
        self._locked = False
        self._file_length = None        # Used to record mailbox size
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except IOError, e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None    # Used to record mailbox size
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except IOError, e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None    # Used to record mailbox size
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except IOError, e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None    # Used to record mailbox size
项目:mock-ssh-server    作者:carletes    | 项目源码 | 文件源码
def returns_sftp_error(func):

    def wrapped(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except OSError as err:
            LOG.debug("Error calling %s(%s, %s): %s",
                      func, args, kwargs, err, exc_info=True)
            errno = err.errno
            if errno in {EACCES, EDQUOT, EPERM, EROFS}:
                return paramiko.SFTP_PERMISSION_DENIED
            if errno in {ENOENT, ENOTDIR}:
                return paramiko.SFTP_NO_SUCH_FILE
            return paramiko.SFTP_FAILURE
        except Exception as err:
            LOG.debug("Error calling %s(%s, %s): %s",
                      func, args, kwargs, err, exc_info=True)
            return paramiko.SFTP_FAILURE

    return wrapped
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except IOError, e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None    # Used to record mailbox size
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except OSError as e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None    # Used to record mailbox size
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except IOError, e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None    # Used to record mailbox size
项目:empyrion-python-api    作者:huhlig    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except IOError, e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None    # Used to record mailbox size
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def __init__(self, path, factory=None, create=True):
        """Initialize a single-file mailbox."""
        Mailbox.__init__(self, path, factory, create)
        try:
            f = open(self._path, 'rb+')
        except OSError as e:
            if e.errno == errno.ENOENT:
                if create:
                    f = open(self._path, 'wb+')
                else:
                    raise NoSuchMailboxError(self._path)
            elif e.errno in (errno.EACCES, errno.EROFS):
                f = open(self._path, 'rb')
            else:
                raise
        self._file = f
        self._toc = None
        self._next_key = 0
        self._pending = False       # No changes require rewriting the file.
        self._pending_sync = False  # No need to sync the file
        self._locked = False
        self._file_length = None    # Used to record mailbox size
项目:obnam    作者:obnam-mirror    | 项目源码 | 文件源码
def __init__(self, path, flags, *mode):
        tracing.trace('path=%r', path)
        tracing.trace('flags=%r', flags)
        tracing.trace('mode=%r', mode)

        self.path = path

        if flags & self.write_flags:
            raise IOError(errno.EROFS, 'Read only filesystem')

        self.reading_pid = path == '/.pid'
        if self.reading_pid:
            return

        try:
            self.metadata = self.fuse_fs.get_metadata_in_generation(path)
        except BaseException:
            logging.error('Unexpected exception', exc_info=True)
            raise

        # if not a regular file return EINVAL
        if not stat.S_ISREG(self.metadata.st_mode):
            raise IOError(errno.EINVAL, 'Invalid argument')
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def remove(self, hashval):
                """This function removes the file associated with the name
                "hashval"."""

                if self.readonly:
                        raise NeedToModifyReadOnlyFileManager(hashval,
                            "remove")
                for l in self.layouts:
                        cur_path = l.lookup(hashval)
                        cur_full_path = os.path.join(self.root, cur_path)
                        try:
                                portable.remove(cur_full_path)
                                os.removedirs(os.path.dirname(cur_full_path))
                        except EnvironmentError as e:
                                if e.errno == errno.ENOENT or \
                                    e.errno == errno.EEXIST:
                                        pass
                                elif e.errno == errno.EACCES or \
                                    e.errno == errno.EROFS:
                                        raise FMPermissionsException(e.filename)
                                else:
                                        raise
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def __mkdtemp(self):
                """Create a temp directory under repository directory for
                various purposes."""

                if not self.root:
                        return

                if self.writable_root:
                        root = self.writable_root
                else:
                        root = self.root

                tempdir = os.path.normpath(os.path.join(root, "tmp"))
                misc.makedirs(tempdir)
                try:
                        return tempfile.mkdtemp(dir=tempdir)
                except EnvironmentError as e:
                        if e.errno == errno.EACCES:
                                raise apx.PermissionsException(
                                    e.filename)
                        if e.errno == errno.EROFS:
                                raise apx.ReadOnlyFileSystemException(
                                    e.filename)
                        raise
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def __write_config(self):
                """Save the repository's current configuration data."""

                # No changes should be written to disk in readonly mode.
                if self.read_only:
                        return

                # Save a new configuration (or refresh existing).
                try:
                        self.cfg.write()
                except EnvironmentError as e:
                        # If we're unable to write due to the following
                        # errors, it isn't critical to the operation of
                        # the repository.
                        if e.errno not in (errno.EPERM, errno.EACCES,
                            errno.EROFS):
                                raise
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def __get_catalog(self, name):
                """Private method to retrieve catalog; this bypasses the
                normal automatic caching (unless the image hasn't been
                upgraded yet)."""

                croot = os.path.join(self._statedir, name)
                try:
                        os.makedirs(croot)
                except EnvironmentError as e:
                        if e.errno in (errno.EACCES, errno.EROFS):
                                # Allow operations to work for
                                # unprivileged users.
                                croot = None
                        elif e.errno != errno.EEXIST:
                                raise

                # batch_mode is set to True here as any operations that modify
                # the catalogs (add or remove entries) are only done during an
                # image upgrade or metadata refresh.  In both cases, the catalog
                # is resorted and finalized so this is always safe to use.
                cat = pkg.catalog.Catalog(batch_mode=True, meta_root=croot,
                    sign=False, file_root=self.imgdir)
                return cat
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def __end_state_update(self):
                """Called when we're done updating the image catalog."""

                # get the path to the image catalog update flag file
                pathname = self.__state_updating_pathname()

                # delete the flag file.
                try:
                        portable.remove(pathname)
                except EnvironmentError as e:
                        if e.errno == errno.EACCES:
                                raise apx.PermissionsException(e.filename)
                        if e.errno == errno.EROFS:
                                raise apx.ReadOnlyFileSystemException(
                                    e.filename)
                        raise
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def _makedirs(newdir):
                """A helper function for _get_files that makes directories,
                if needed."""

                if not os.path.exists(newdir):
                        try:
                                os.makedirs(newdir)
                        except EnvironmentError as e:
                                if e.errno == errno.EACCES:
                                        raise apx.PermissionsException(
                                            e.filename)
                                if e.errno == errno.EROFS:
                                        raise apx.ReadOnlyFileSystemException(
                                            e.filename)
                                raise tx.TransportOperationError("Unable to "
                                    "make directory: {0}".format(e))
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def _convert_error(e, ignored_errors=EmptyI):
        """Converts the provided exception into an ApiException equivalent if
        possible.  Returns a new exception object if converted or the original
        if not.

        'ignored_errors' is an optional list of errno values for which None
        should be returned.
        """

        if not hasattr(e, "errno"):
                return e
        if e.errno in ignored_errors:
                return None
        if e.errno in (errno.EACCES, errno.EPERM):
                return PermissionsException(e.filename)
        if e.errno == errno.EROFS:
                return ReadOnlyFileSystemException(e.filename)
        return e
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def makedirs(pathname):
        """Create a directory at the specified location if it does not
        already exist (including any parent directories).
        """

        try:
                os.makedirs(pathname, PKG_DIR_MODE)
        except EnvironmentError as e:
                if e.filename == pathname and (e.errno == errno.EEXIST or
                    os.path.exists(e.filename)):
                        return
                elif e.errno in (errno.EACCES, errno.EROFS):
                        raise search_errors.ProblematicPermissionsIndexException(
                            e.filename)
                elif e.errno != errno.EEXIST or e.filename != pathname:
                        raise
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def makedirs(pathname):
        """Create a directory at the specified location if it does not
        already exist (including any parent directories) re-raising any
        unexpected exceptions as ApiExceptions.
        """

        try:
                os.makedirs(pathname, PKG_DIR_MODE)
        except EnvironmentError as e:
                if e.filename == pathname and (e.errno == errno.EEXIST or
                    os.path.exists(e.filename)):
                        return
                elif e.errno == errno.EACCES:
                        raise api_errors.PermissionsException(
                            e.filename)
                elif e.errno == errno.EROFS:
                        raise api_errors.ReadOnlyFileSystemException(
                            e.filename)
                elif e.errno != errno.EEXIST or e.filename != pathname:
                        raise
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def open(self, inode, flags, ctx):
        flags_writable = os.O_WRONLY | os.O_RDWR | os.O_APPEND
        if flags & flags_writable > 0:
            raise llfuse.FUSEError(errno.EROFS)

        return self._yarp_cell_relative_offset_to_handle(inode)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def create(self, parent_inode, name, mode, flags, ctx):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def fsync(self, fh, datasync):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def fsyncdir(self, fh, datasync):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def link(self, inode, new_parent_inode, new_name, ctx):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def mknod(self, parent_inode, name, mode, rdev, ctx):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def removexattr(self, inode, name, ctx):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def rename(self, parent_inode_old, name_old, parent_inode_new, name_new, ctx):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def rmdir(self, parent_inode, name, ctx):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def setattr(self, inode, attr, fields, fh, ctx):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def symlink(self, parent_inode, name, target, ctx):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def unlink(self, parent_inode, name, ctx):
        raise llfuse.FUSEError(errno.EROFS)
项目:yarp    作者:msuhanov    | 项目源码 | 文件源码
def write(self, fh, off, buf):
        raise llfuse.FUSEError(errno.EROFS)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def _lock_file(f, dotlock=True):
    """Lock file f using lockf and dot locking."""
    dotlock_done = False
    try:
        if fcntl:
            try:
                fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
            except OSError as e:
                if e.errno in (errno.EAGAIN, errno.EACCES, errno.EROFS):
                    raise ExternalClashError('lockf: lock unavailable: %s' %
                                             f.name)
                else:
                    raise
        if dotlock:
            try:
                pre_lock = _create_temporary(f.name + '.lock')
                pre_lock.close()
            except OSError as e:
                if e.errno in (errno.EACCES, errno.EROFS):
                    return  # Without write access, just skip dotlocking.
                else:
                    raise
            try:
                if hasattr(os, 'link'):
                    os.link(pre_lock.name, f.name + '.lock')
                    dotlock_done = True
                    os.unlink(pre_lock.name)
                else:
                    os.rename(pre_lock.name, f.name + '.lock')
                    dotlock_done = True
            except FileExistsError:
                os.remove(pre_lock.name)
                raise ExternalClashError('dot lock unavailable: %s' %
                                         f.name)
    except:
        if fcntl:
            fcntl.lockf(f, fcntl.LOCK_UN)
        if dotlock_done:
            os.remove(f.name + '.lock')
        raise
项目:fuse-3ds    作者:ihaveamac    | 项目源码 | 文件源码
def create(self, path, mode, **kwargs):
        if self.readonly:
            raise FuseOSError(errno.EROFS)
        return os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, mode)
项目:fuse-3ds    作者:ihaveamac    | 项目源码 | 文件源码
def mknod(self, path, *args, **kwargs):
        if self.readonly:
            raise FuseOSError(errno.EROFS)
        if not common.windows:
            os.mknod(path, *args, **kwargs)

    # open = os.open
项目:fuse-3ds    作者:ihaveamac    | 项目源码 | 文件源码
def rename(self, old, new):
        # TODO: proper rename support - this may not happen because there's not
        #   much reason to rename files here. copying might work since either
        #   way, the file[s] would have to be re-encrypted.
        raise FuseOSError(errno.EROFS if self.readonly else errno.EPERM)
        # if self.readonly:
        #     raise FuseOSError(errno.EROFS)
        # return os.rename(old, self.root + new)
项目:fuse-3ds    作者:ihaveamac    | 项目源码 | 文件源码
def write(self, path, data, offset, fh):
        if self.readonly:
            raise FuseOSError(errno.EROFS)
        # special check for special files
        if os.path.basename(path).startswith('.'):
            if common.windows:
                f = open(path, 'r+b', buffering=0)
                f.seek(offset)
                return f.write(data)
            else:
                with self.rwlock:
                    os.lseek(fh, offset, 0)
                    return os.write(fh, data)

        before = offset % 16
        iv = self.path_to_iv(path) + (offset >> 4)
        out_data = self.crypto.aes_ctr(0x34, iv, (b'\0' * before) + data)[before:]
        if common.windows:
            with open(path, 'r+b', buffering=0) as f:
                f.seek(offset - before)
                written = f.write(out_data)
        else:
            with self.rwlock:
                os.lseek(fh, offset, 0)
                written = os.write(fh, out_data)

        return written
项目:Deploy_XXNET_Server    作者:jzp820927    | 项目源码 | 文件源码
def fake_open(filename, flags, mode=0777, _os_open=os.open):
  """Fake version of os.open."""
  # A copy of os.open is saved in _os_open so it can still be used after os.open
  # is replaced with this stub.
  if flags & (os.O_RDWR | os.O_CREAT | os.O_WRONLY):
    raise OSError(errno.EROFS, 'Read-only file system', filename)
  elif not FakeFile.is_file_accessible(filename):
    raise OSError(errno.ENOENT, 'No such file or directory', filename)
  return _os_open(filename, flags, mode)
项目:Deploy_XXNET_Server    作者:jzp820927    | 项目源码 | 文件源码
def __init__(self, filename, mode='r', bufsize=-1, **kwargs):
    """Initializer. See file built-in documentation."""
    if mode not in FakeFile.ALLOWED_MODES:
      raise IOError(errno.EROFS, 'Read-only file system', filename)

    if not FakeFile.is_file_accessible(filename):
      raise IOError(errno.EACCES, 'file not accessible', filename)

    super(FakeFile, self).__init__(filename, mode, bufsize, **kwargs)
项目:Deploy_XXNET_Server    作者:jzp820927    | 项目源码 | 文件源码
def test_fake_open_write(self):
    self.mox.ReplayAll()
    with self.assertRaises(OSError) as cm:
      stubs.fake_open(__file__, os.O_RDWR)
    self.mox.VerifyAll()
    e = cm.exception
    self.assertEqual(errno.EROFS, e.errno)
    self.assertEqual('Read-only file system', e.strerror)
    self.assertEqual(__file__, e.filename)
    self.mox.VerifyAll()
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def _lock_file(f, dotlock=True):
    """Lock file f using lockf and dot locking."""
    dotlock_done = False
    try:
        if fcntl:
            try:
                fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
            except OSError as e:
                if e.errno in (errno.EAGAIN, errno.EACCES, errno.EROFS):
                    raise ExternalClashError('lockf: lock unavailable: %s' %
                                             f.name)
                else:
                    raise
        if dotlock:
            try:
                pre_lock = _create_temporary(f.name + '.lock')
                pre_lock.close()
            except OSError as e:
                if e.errno in (errno.EACCES, errno.EROFS):
                    return  # Without write access, just skip dotlocking.
                else:
                    raise
            try:
                if hasattr(os, 'link'):
                    os.link(pre_lock.name, f.name + '.lock')
                    dotlock_done = True
                    os.unlink(pre_lock.name)
                else:
                    os.rename(pre_lock.name, f.name + '.lock')
                    dotlock_done = True
            except FileExistsError:
                os.remove(pre_lock.name)
                raise ExternalClashError('dot lock unavailable: %s' %
                                         f.name)
    except:
        if fcntl:
            fcntl.lockf(f, fcntl.LOCK_UN)
        if dotlock_done:
            os.remove(f.name + '.lock')
        raise
项目:toy-orgfuse    作者:vkazanov    | 项目源码 | 文件源码
def readdir(self, path, fh):
        node = self.tree.find_path(path)
        if node is None:
            raise FuseOSError(EROFS)
        return ['.', '..'] + [child for child in node.children]
项目:obnam    作者:obnam-mirror    | 项目源码 | 文件源码
def chmod(self, path, mode):
        raise IOError(errno.EROFS, 'Read only filesystem')
项目:obnam    作者:obnam-mirror    | 项目源码 | 文件源码
def chown(self, path, uid, gid):
        raise IOError(errno.EROFS, 'Read only filesystem')
项目:obnam    作者:obnam-mirror    | 项目源码 | 文件源码
def link(self, targetPath, linkPath):
        raise IOError(errno.EROFS, 'Read only filesystem')
项目:obnam    作者:obnam-mirror    | 项目源码 | 文件源码
def mkdir(self, path, mode):
        raise IOError(errno.EROFS, 'Read only filesystem')
项目:obnam    作者:obnam-mirror    | 项目源码 | 文件源码
def rename(self, oldPath, newPath):
        raise IOError(errno.EROFS, 'Read only filesystem')