| 35 |
|
#print self.imagesDir |
| 36 |
|
#destinationDir = self.imagesProcessedDir + "\\Printing\\" + projectName.split('\n')[0] + "\\" + os.path.split(absFile.lower().split(self.imagesDir.lower())[1])[0] |
| 37 |
|
#print destinationDir |
| 38 |
< |
print "-"*80 |
| 39 |
< |
print "copying %s\n"% absInputFile |
| 38 |
> |
print("-"*80) |
| 39 |
> |
print("copying %s\n"% absInputFile) |
| 40 |
|
|
| 41 |
|
try: |
| 42 |
|
if verify == 0: |
| 43 |
|
if os.path.exists(destinationDir) == 0: |
| 44 |
|
os.makedirs(destinationDir) |
| 45 |
|
if os.path.isfile(destinationDir + "\\" + outputFile): |
| 46 |
< |
print "duplicate File. Skipping..." |
| 46 |
> |
print("duplicate File. Skipping...") |
| 47 |
|
else: |
| 48 |
< |
print destinationDir+"\\"+outputFile |
| 48 |
> |
print(destinationDir+"\\"+outputFile) |
| 49 |
|
shutil.copy2(absInputFile,destinationDir+"\\"+outputFile) |
| 50 |
< |
print "Done!\n" |
| 50 |
> |
print("Done!\n") |
| 51 |
|
#copySuccess = open(self.workDir + '\\copySuccess.log','a') |
| 52 |
|
#copySuccess.write(absFile+'\n') |
| 53 |
|
#copySuccess.close() |
| 54 |
|
except: |
| 55 |
< |
print "This file could not be copied! It either dosent exist or something is wrong with the path..." |
| 55 |
> |
print("This file could not be copied! It either dosent exist or something is wrong with the path...") |
| 56 |
|
if os.path.exists(self.logsDir) == 0: |
| 57 |
|
os.makedirs(self.logsDir) |
| 58 |
|
copyError = open(self.logsDir + '\\copyError.log','a') |
| 70 |
|
def HashFile(self, absFilePath): |
| 71 |
|
"""Current supported Algorithms are: md5, sha1, sha224, sha256""" |
| 72 |
|
binContents = open(absFilePath,'rb').read() |
| 73 |
< |
print "-"*80 |
| 74 |
< |
print "Creating a %s hash digest from file\n%s"%(self.hashAlgorithm, absFilePath) |
| 75 |
< |
print "-"*80 |
| 73 |
> |
print("-"*80) |
| 74 |
> |
print("Creating a %s hash digest from file\n%s"%(self.hashAlgorithm, absFilePath)) |
| 75 |
> |
print("-"*80) |
| 76 |
|
if self.hashAlgorithm == 'md5': |
| 77 |
|
hashVal = hashlib.md5(binContents).hexdigest() |
| 78 |
|
elif self.hashAlgorithm == 'sha1': |
| 82 |
|
elif self.hashAlgorithm == 'sha256': |
| 83 |
|
hashVal = hashlib.sha256(binContents).hexdigest() |
| 84 |
|
else: |
| 85 |
< |
print "Unsupported algorithm!" |
| 85 |
> |
print("Unsupported algorithm!") |
| 86 |
|
hashVal = '0' |
| 87 |
|
return hashVal |
| 88 |
|
|