From 6e42ef0edaba59fd344e89ffd469202ff2bd39ac Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@fe.uni-lj.si>
Date: Tue, 15 Mar 2016 15:40:24 +0000
Subject: [PATCH] File locking into .lock seems to work fine

---
 python/trisurf/trisurf.py |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/python/trisurf/trisurf.py b/python/trisurf/trisurf.py
index 67a0813..bf0809e 100644
--- a/python/trisurf/trisurf.py
+++ b/python/trisurf/trisurf.py
@@ -8,6 +8,7 @@
 import os
 from itertools import islice
 import mmap
+import shlex
 '''
 This is a trisurf instance manager written in python
 
@@ -129,16 +130,25 @@
 					i=0;
 					for line in fin:
 						if(i==1):
-							print (line)
+							#print (line)
+							fields=shlex.split(line)
+							epoch1=fields[0]
+							n1=fields[1]
 						if(i==nlines-1):
-							print (line)
+							fields=shlex.split(line)
+							epoch2=fields[0]
+							n2=fields[1]
 						i=i+1
 			except:
 				print("Cannot read statistics file in "+self.fullname+"\n")
-				exit(1)
+				return(False)
 		else:
 			print("File "+self.fullname+" does not exists.\n")
-			exit(1)
+			return(False)
+
+		self.dT=(int(epoch2)-int(epoch1))/(int(n2)-int(n1))
+		return(True)
+
 
 class Runner:
 	'''

--
Gitblit v1.9.3