WindowsXPでPython2.7を使用しています。
私のスクリプトは、tempfile.mkstempとtempfile.mkdtempに依存して、次のパターンで多数のファイルとディレクトリを作成します。
_,_tmp = mkstemp(prefix=section,dir=indir,text=True)
<do something with file>
os.close(_)
スクリプトを実行すると、常に次のエラーが発生します(ただし、正確な行番号は変更されますなど)。スクリプトが開こうとしている実際のファイルはさまざまです。
OSError: [Errno 24] Too many open files: 'path\\to\\most\\recent\\attempt\\to\\open\\file'
これをどのようにデバッグするかについて何か考えはありますか?また、追加情報が必要な場合はお知らせください。ありがとう!
編集:
使用例を次に示します。
out = os.fdopen(_,'w')
out.write("Something")
out.close()
with open(_) as p:
p.read()