Mercurial Hosting > traffic-intelligence
diff python/storage.py @ 882:4749b71aa7fb
corrected bugs in storage.py when having configuration files and other files in different directories: everything should be relative to directory of command line when running the program (see FAQ)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 15 Mar 2017 12:36:03 -0400 |
parents | 000555430b28 |
children | f766fe0995f4 |
line wrap: on
line diff
--- a/python/storage.py Tue Mar 14 17:48:40 2017 -0400 +++ b/python/storage.py Wed Mar 15 12:36:03 2017 -0400 @@ -1291,24 +1291,19 @@ config = ConfigParser() config.readfp(FakeSecHead(openCheck(filename))) - # check if path contains directory names - if len(path.split(filename)[0]) == 0: - dirname = '.'+path.sep - else: - dirname = path.split(filename)[0]+path.sep self.sectionHeader = config.sections()[0] # Tracking/display parameters self.videoFilename = config.get(self.sectionHeader, 'video-filename') self.databaseFilename = config.get(self.sectionHeader, 'database-filename') self.homographyFilename = config.get(self.sectionHeader, 'homography-filename') - if path.exists(dirname+self.homographyFilename): - self.homography = loadtxt(dirname+self.homographyFilename) + if path.exists(self.homographyFilename): + self.homography = loadtxt(self.homographyFilename) else: self.homography = None self.intrinsicCameraFilename = config.get(self.sectionHeader, 'intrinsic-camera-filename') - if path.exists(dirname+self.intrinsicCameraFilename): - self.intrinsicCameraMatrix = loadtxt(dirname+self.intrinsicCameraFilename) + if path.exists(self.intrinsicCameraFilename): + self.intrinsicCameraMatrix = loadtxt(self.intrinsicCameraFilename) else: self.intrinsicCameraMatrix = None distortionCoefficients = getValuesFromINIFile(filename, 'distortion-coefficients', '=')