X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FCommon%2FMisc.py;h=01171adb9b9e49754f0163873ae4d8feefe997c1;hp=24706ebe500fc437ce3ed8e9b63feceacebda09f;hb=92beb1e4c73a40a708c7c0cade5c7cee314b3887;hpb=caf744956d4c8c0ef358bdc3df2cdb10265c2ea8 diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 24706ebe50..01171adb9b 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -478,7 +478,7 @@ def SaveFileOnChange(File, Content, IsBinaryFile=True): Fd = open(File, "wb") Fd.write(Content) Fd.close() - except IOError, X: + except IOError as X: EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData='IOError %s' % X) return True @@ -512,7 +512,7 @@ def DataRestore(File): try: Fd = open(File, 'rb') Data = cPickle.load(Fd) - except Exception, e: + except Exception as e: EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e))) Data = None finally: @@ -1278,7 +1278,7 @@ def ParseDevPathValue (Value): try: p = subprocess.Popen(Cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) out, err = p.communicate() - except Exception, X: + except Exception as X: raise BadExpression("DevicePath: %s" % (str(X)) ) finally: subprocess._cleanup() @@ -1293,7 +1293,7 @@ def ParseDevPathValue (Value): def ParseFieldValue (Value): if type(Value) == type(0): return Value, (Value.bit_length() + 7) / 8 - if type(Value) <> type(''): + if type(Value) != type(''): raise BadExpression('Type %s is %s' %(Value, type(Value))) Value = Value.strip() if Value.startswith(TAB_UINT8) and Value.endswith(')'): @@ -1327,7 +1327,7 @@ def ParseFieldValue (Value): Value = Value[1:-1] try: Value = "'" + uuid.UUID(Value).get_bytes_le() + "'" - except ValueError, Message: + except ValueError as Message: raise BadExpression(Message) Value, Size = ParseFieldValue(Value) return Value, 16