gpt4 book ai didi

python-3.x - OSError : 269892000 requested and 269188084 written

转载 作者:行者123 更新时间:2023-12-04 14:25:02 26 4
gpt4 key购买 nike

在执行“array.tofile(fp)”行时,出现OSError,该错误表示“OSError:请求269892000,并写入了269188084”。我能确切知道这是什么意思,对此可能的解决方案是什么?

def write_array(fp, array, version=None, allow_pickle=True, pickle_kwargs=None):
...
...**strong text**
_check_version(version)
used_ver = _write_array_header(fp, header_data_from_array_1_0(array),
version)
# this warning can be removed when 1.9 has aged enough
if version != (2, 0) and used_ver == (2, 0):
warnings.warn("Stored array in format 2.0. It can only be"
"read by NumPy >= 1.9", UserWarning)

# Set buffer size to 16 MiB to hide the Python loop overhead.
buffersize = max(16 * 1024 ** 2 // array.itemsize, 1)

if array.dtype.hasobject:
# We contain Python objects so we cannot write out the data
# directly. Instead, we will pickle it out with version 2 of the
# pickle protocol.
if not allow_pickle:
raise ValueError("Object arrays cannot be saved when "
"allow_pickle=False")
if pickle_kwargs is None:
pickle_kwargs = {}
pickle.dump(array, fp, protocol=2, **pickle_kwargs)
elif array.flags.f_contiguous and not array.flags.c_contiguous:
if isfileobj(fp):
array.T.tofile(fp)
else:
for chunk in numpy.nditer(
array, flags=['external_loop', 'buffered', 'zerosize_ok'],
buffersize=buffersize, order='F'):
fp.write(chunk.tobytes('C'))
else:
if isfileobj(fp):
print("Entered1")
array.tofile(fp)
else:
for chunk in numpy.nditer(
array, flags=['external_loop', 'buffered', 'zerosize_ok'],
buffersize=buffersize, order='C'):
fp.write(chunk.tobytes('C'))

最佳答案

当您使用numpy.load的变体读取数据但驱动器中没有足够的空间时,会出现此问题。

该错误基本上意味着numpy正在请求269892000,但由于空间限制,它只能在269188084中读取/保存。

释放一些空间!

关于python-3.x - OSError : 269892000 requested and 269188084 written,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37657939/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com