我使用python2在最新的Docker Ubuntu图片中运行了以下代码:
码头工人:
docker pull ubuntu
docker run -it ubuntu /bin/bash
码头工人:
apt update
apt install python
touch test
python
在python中:
>>> import struct
>>> import fcntl
>>> f = open("test", "rb")
>>> binary_data = fcntl.ioctl(f, 2, struct.pack('I', 0))
错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 22] Invalid argument
同样的流程,我在我的电脑和结果,我没有得到任何错误。 我怀疑文件描述符有问题。在这两种情况下,当我调用f.fileno()时,我得到了结果3。在这两种情况下,我都在python2.7.16上运行它
但当我在码头跑的时候:
>>> import struct
>>> import fcntl
>>> f = open("test", "rb")
>>> binary_data = fcntl.ioctl(2, 2, struct.pack('I', 0))
我没有错。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐