I wrote a python script. When I run it directly(like below) it works fine.
python check_C1_criteria_file.py > test.out
But when I run it in background(like below) it neither shows any result nor error.
python check_C1_criteria_file.py > test.out &
or
nohup python check_C1_criteria_file.py &
What can go wrong? Can anyone help me with this?
Update:
The main part of the script is as follow:
blastOutput_file=sys.argv[1];
lengthFile = sys.argv[2];
with open(blastOutput_file, 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter='\t')
sys.stdout.write('#query_id'+'\t'+'Mapping_Id'+'\t'+'Description'+'\n');
for row in reader:
tid=row[0];
subid=row[1];
mapid=getMapping_id(subid);
idDes = search_id(lengthFile, mapid);
if idDes is not None:
sys.stdout.write(tid+'\t'+str(mapid)+'\t'+str(idDes)+'\n');
Am I missing something?
nohup python check_C1_criteria_file.py > file.log &sys.stdout.flush()'s after your prints or use the logging module. Does it still not output?