Using os.path.getsize instead of os.stat

This commit is contained in:
John Evans 2013-07-15 18:49:38 -04:00
commit 34b45ba822
2 changed files with 3 additions and 4 deletions

View file

@ -73,7 +73,7 @@ class Jp2kBox(object):
self.offset = offset self.offset = offset
self.longname = longname self.longname = longname
# should never be used except for last box in file. # should never be used except maybe for last box in file.
self._file_size = -1 self._file_size = -1
def __str__(self): def __str__(self):

View file

@ -118,9 +118,8 @@ class Jp2k(Jp2kBox):
IOError IOError
The file was not JPEG 2000. The file was not JPEG 2000.
""" """
stat = os.stat(self.filename) self.length = os.path.getsize(self.filename)
self.length = stat.st_size self._file_size = os.path.getsize(self.filename)
self._file_size = stat.st_size
with open(self.filename, 'rb') as fptr: with open(self.filename, 'rb') as fptr: