Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOError:[Errno 22]参数python write无效_Python_Python 2.7 - Fatal编程技术网

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,这同样会影响其他人。

您使用的是什么操作系统?