Re: Problem with reading files in python

Kostas Liakakis <[email protected]>
Newsgroups gmane.comp.file-systems.openafs.general
Message-ID <[email protected]>
Hi,

Probably it's the r+b mode you are using... 'r+' means open for read and 
write, placing the file pointer at the start.

Try with 'rb' instead.

-K.

On 27/06/2022 16.21, Stephen Quinney wrote:
> I have a slightly puzzling issue with Python, I am trying to open a
> ISO file that is stored in AFS. in binary mode just for reading.
>
> I have read permission on the directory but not write:
>
> % fs listacl foo
> Access list for foo is
> Normal rights:
>    system:administrators rlidwka
>    squinney rl
>
> If I open the file as normal (i.e. text mode) it works fine but when I
> attempt to use binary mode I get permission denied.
>
> % python3
> Python 3.8.10 (default, Mar 15 2022, 12:22:08)
> [GCC 9.4.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> open("foo/example.iso")
> <_io.TextIOWrapper name='foo/example.iso' mode='r' encoding='UTF-8'>
>>>> open("foo/example.iso",mode="r+b")
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> PermissionError: [Errno 13] Permission denied: 'foo/example.iso'
>
> If I copy the directory to a local filesystem it all works as
> expected. What am I missing here?
>
>
> Thanks,
>
> Stephen Quinney
> _______________________________________________
> OpenAFS-info mailing list
> [email protected]
> https://lists.openafs.org/mailman/listinfo/openafs-info
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.