简体   繁体   English

PermissionError:[Errno 1]写后读取时,Python中不允许进行此操作

[英]PermissionError: [Errno 1] Operation not permitted in Python while reading after write

I encountered following problem while writing my program: I have binary file, via which 2 processes are communicating, one of them is my python program. 我在编写程序时遇到以下问题:我有一个二进制文件,通过它进行2个进程的通信,其中之一是我的python程序。 I open file with os: 我用os打开文件:

self.io_file = os.open(med_file, os.O_RDWR)

so I can read it binary. 所以我可以读二进制。 I read content of the file, then try to write answer into the same file (I'm at the end of file, of course). 我读取了文件的内容,然后尝试将答案写到同一文件中(当然,我在文件末尾)。 Everything's alright up until I try to read again (new question) after this write. 一切都很好,直到我写完这篇文章再试一次(新问题)。 Then following happens: 然后发生以下情况:

Traceback (most recent call last):
File "/home/ydenko/program.py", line 172, in read
return os.read(self.io_file, msg_size)
PermissionError: [Errno 1] Operation not permitted

I find it curious that up until I write something, everything works flawlessly. 我感到奇怪的是,直到我写点东西,一切都完美无瑕。 Any idea why this happens? 知道为什么会这样吗?

  • Check if you have write permission to that directory 检查您是否对该目录具有写权限
  • Check if the system is mounted in rw mode 检查系统是否以rw模式安装
  • Also check lsattr if somebody has set the extended attributes 同时检查lsattr是否有人设置了扩展属性

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 覆盖范围 - PermissionError: [Errno 1] 不允许操作 - Coverage - PermissionError: [Errno 1] Operation not permitted PermissionError: [Errno 1] 在 iPadOS 14 上使用 Pyto 时不允许操作 - PermissionError: [Errno 1] Operation not permitted while using Pyto on iPadOS 14 PermissionError: [Errno 1] docker conatiner 尝试连接到数据库时不允许操作 - PermissionError: [Errno 1] Operation not permitted while a docker conatiner tries to connect to database PermissionError:[Errno 1] macOS Catalina 更新后不允许操作 - PermissionError: [Errno 1] Operation not permitted after macOS Catalina Update Python3 Sockets - PermissionError: [Errno 1] Operation not allowed - 作为 root 运行 - Python3 Sockets - PermissionError: [Errno 1] Operation not permitted - running as root Dockerfile Raspberry PI Python pip install "PermissionError: [Errno 1] Operation not allowed" - Dockerfile Raspberry PI Python pip install "PermissionError: [Errno 1] Operation not permitted" 使用Stanfordcorenlp发生PermissionError:[Errno 1]不允许操作 - using Stanfordcorenlp occurs PermissionError: [Errno 1] Operation not permitted PermissionError: [Errno 1] Operation not allowed: 'file.txt' -> 'symlink.txt' while using os.symlink - PermissionError: [Errno 1] Operation not permitted: 'file.txt' -> 'symlink.txt' while using os.symlink Python 中的 Chmod - [Errno 1] 不允许操作 - Chmod in Python - [Errno 1] Operation not permitted Python fcntl.ioctl [Errno 1] 不允许操作 - Python fcntl.ioctl [Errno 1] Operation not permitted
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM