3 Test N3 to time file reading
6 from __future__ import print_function
8 from clock import clock
9 from m_lib.pbar.tty_pbar import ttyProgressBar
13 print("Test: ", end=' ')
16 size = os.path.getsize(sys.argv[1])
17 infile = open(sys.argv[1])
18 pbar = ttyProgressBar(0, size)
24 # This is for DOS - it counts CRLF, which len() counts as 1 char!
25 if os.name == 'dos' or os.name == 'nt' :
28 dos_add = 0 # UNIX' and Mac's len() counts CR or LF correct
31 line = infile.readline()
34 lng = lng + len(line) + dos_add
43 if __name__ == "__main__":
45 print("Overall time:", clock())