Skip to content

open_fs(".", writeable=False) returns an FS object which can write #441

Closed
@mezhaka

Description

@mezhaka

I'd like to have read-only FS, however I am able to do

from fs.opener import open_fs
with open_fs(".", writeable=False) as fs_:
    fs_.writetext("spam", "vikings")

I'd expect it to fail, like the

from fs.wrap import read_only, WrapReadOnly
r = read_only(fs_)
r.writetext("spam", "vikings")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/disks/repo/bin/miniconda3/envs/deeplearning/lib/python3.8/site-packages/fs/wrap.py", line 221, in writetext
    raise ResourceReadOnly(path)
fs.errors.ResourceReadOnly: resource 'spam' is read only

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsIssues related to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions