IOError:[Errno 22]参数python write无效
我写的是网络共享,这是一段代码IOError:[Errno 22]参数python write无效,python,python-2.7,Python,Python 2.7,我写的是网络共享,这是一段代码 while not created: fileName = ''.join(random.choice(CANDIDATE_CHARS) for x in range(len)) fullPath = os.path.join(base, fileName) if not os.path.exists(fullPath): filesize = random.randint(fileSizeLowerLim, fileSiz
while not created:
fileName = ''.join(random.choice(CANDIDATE_CHARS) for x in range(len))
fullPath = os.path.join(base, fileName)
if not os.path.exists(fullPath):
filesize = random.randint(fileSizeLowerLim, fileSizeUpperLim)
logger.info("Creating file %s, with size %d" %(fullPath, filesize))
with open(fullPath, 'wb') as fout:
if filesize > 0:
fout.write(os.urandom(filesize * 1048576))
sizeLimit -= filesize
allFiles.append(fullPath)
created = True
logger.info("Created file %s, now limit is %d" %(fullPath, sizeLimit))
我得到了这个错误:
fout.write(os.urandom(filesize * 1048576))
IOError: [Errno 22] Invalid argument
job remoteMachine finished ended with rc = 1
remoteMachine finished and it failed
当我查看文件时,它是生成的,但并没有数据。python中有我遗漏的东西吗
我正在使用32位python在windows 7上运行脚本。我怀疑您的“Uradom”缓冲区超过64MB,因此会命中windows,这同样会影响其他人。您使用的是什么操作系统?