Changeset 38956 for trunk/ippToPsps/jython/fits.py
- Timestamp:
- Oct 23, 2015, 6:06:25 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/fits.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/fits.py
r35417 r38956 4 4 import re 5 5 import shutil 6 import hashlib 7 from subprocess import call, PIPE, Popen 6 8 7 9 ''' … … 42 44 # move file pointer back to the start of the file 43 45 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() 44 67 45 68 '''
Note:
See TracChangeset
for help on using the changeset viewer.
