Trisurf Monte Carlo simulator
Samo Penic
2016-05-17 d665c0b94c289f6c34597af3010d6b9b38a08ac4
Fixes error occuring when statistics.csv is empty.
1 files modified
5 ■■■■■ changed files
python/trisurf/trisurf.py 5 ●●●●● patch | view | raw | blame | history
python/trisurf/trisurf.py
@@ -199,11 +199,16 @@
        Internal method for determining the number of the lines in the most efficient way. Is it really the most efficient?
        '''
        f = open(self.fullname, "r+")
        try:
        buf = mmap.mmap(f.fileno(), 0)
        lines = 0
        readline = buf.readline
        while readline():
            lines += 1
            f.close()
        except:
            lines=0
            f.close()
        return lines
    def read(self):