allpy
changeset 599:56d62d405021
pair_cores_all.py: close openned files to avoid error
error "Too many openned files" occured in child processes
multiprocessing seems to use old process when new python process
is created to avoid increasing of process number. Therefore
files openned in childred are not closed automatically
author | boris (kodomo) <bnagaev@gmail.com> |
---|---|
date | Sun, 03 Apr 2011 17:05:32 +0400 |
parents | 73d960b9bee6 |
children | 72a958b9f5c3 ee2c10aa74b8 |
files | pair_cores/pair_cores_all.py |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- a/pair_cores/pair_cores_all.py Sun Apr 03 17:00:38 2011 +0400 1.2 +++ b/pair_cores/pair_cores_all.py Sun Apr 03 17:05:32 2011 +0400 1.3 @@ -1,3 +1,4 @@ 1.4 +#!/usr/bin/python 1.5 1.6 import sys 1.7 import os 1.8 @@ -21,6 +22,10 @@ 1.9 run(args) 1.10 except: 1.11 pass 1.12 + args.i.close() 1.13 + args.o.close() 1.14 + args.H.close() 1.15 + args.b.close() 1.16 1.17 def tasks(): 1.18 for file in os.listdir(d_in):