私はネットワーク共有に書き込んでいますが、これは書き込むコードの一部です
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 でスクリプトを実行しています。