ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Tool_Box/NinoGenTools.py
(Generate patch)

Comparing Python/NinoCode/Tool_Box/NinoGenTools.py (file contents):
Revision 743 by ninoborges, Sat May 5 04:21:19 2012 UTC vs.
Revision 744 by nino.borges, Tue Apr 13 21:40:41 2021 UTC

# Line 35 | Line 35 | class CopyFile:
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')
# Line 70 | Line 70 | class HashFileContents:
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':
# Line 82 | Line 82 | class HashFileContents:
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)