Project

General

Profile

« Previous | Next » 

Revision 4415

inputs/REMIB/nodes.make: Write log messages to a log file ($0.log) instead of to sys.stderr, because the verbose log messages should not fill up stderr. To view the progress, you should instead tail the created log file.

View differences:

nodes.make
1 1
#!/usr/bin/env python
2 2
# Downloads REMIB data for all nodes
3
# Usage: env [start=...] [n=...] self 2>>log
3
# Usage: env [start=...] [n=...] self
4 4

  
5 5
import csv
6 6
import itertools
......
39 39
    end = util.cast(int, util.none_if(opts.get_env_var('n', None), u''))
40 40
    if end != None: end += start
41 41
    
42
    def clear_line(): sys.stderr.write('\n')
42
    log_ = open(sys.argv[0]+'.log', 'a')
43
    def clear_line(): log_.write('\n')
43 44
    log_indent = 0
44 45
    def log(msg, line_ending='\n'):
45
        sys.stderr.write(('    '*log_indent)+msg+line_ending)
46
        log_.write(('    '*log_indent)+msg+line_ending)
46 47
    
47 48
    os.chdir(os.path.dirname(__file__)) # dir of output files
48 49
    

Also available in: Unified diff