IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 23, 2015, 6:06:25 PM (11 years ago)
Author:
mhuber
Message:

adding md5sum for frame,stack,diff,forcedwarpMeta (was working for frame+stack)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/fits.py

    r35417 r38956  
    44import re
    55import shutil
     6import hashlib
     7from subprocess import call, PIPE, Popen
    68
    79'''
     
    4244       # move file pointer back to the start of the file
    4345       self.rewindToStart()
     46
     47
     48    '''
     49    Get md5sum for file
     50    '''
     51    def getMd5sum(self):
     52        ## memory inefficient all at once read but should be ok...
     53        md5 = hashlib.md5(open(self.originalPath,'rb').read())
     54        return md5.hexdigest()
     55
     56    def getMd5sumShell(self):
     57        md5cmd = "md5sum %s" % (self.originalPath)
     58        md5 = Popen(md5cmd, shell=True, stdout=PIPE).stdout.read()
     59        return md5[0:32]
     60
     61    def getMd5sumFile(self):
     62        ## unclear if rb by default for file so maybe not best
     63        md5 = hashlib.md5(self.file.read())
     64        ## if used, then need to move file pointer back to the start of the file for others to use
     65        self.rewindToStart()
     66        return md5.hexdigest()
    4467
    4568    '''
Note: See TracChangeset for help on using the changeset viewer.