]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/Misc.py
BaseTools: Replace StandardError with Expression
[mirror_edk2.git] / BaseTools / Source / Python / Common / Misc.py
index 24706ebe500fc437ce3ed8e9b63feceacebda09f..01171adb9b9e49754f0163873ae4d8feefe997c1 100644 (file)
@@ -478,7 +478,7 @@ def SaveFileOnChange(File, Content, IsBinaryFile=True):
             Fd = open(File, "wb")\r
             Fd.write(Content)\r
             Fd.close()\r
-    except IOError, X:\r
+    except IOError as X:\r
         EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData='IOError %s' % X)\r
 \r
     return True\r
@@ -512,7 +512,7 @@ def DataRestore(File):
     try:\r
         Fd = open(File, 'rb')\r
         Data = cPickle.load(Fd)\r
-    except Exception, e:\r
+    except Exception as e:\r
         EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))\r
         Data = None\r
     finally:\r
@@ -1278,7 +1278,7 @@ def ParseDevPathValue (Value):
     try:\r
         p = subprocess.Popen(Cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
         out, err = p.communicate()\r
-    except Exception, X:\r
+    except Exception as X:\r
         raise BadExpression("DevicePath: %s" % (str(X)) )\r
     finally:\r
         subprocess._cleanup()\r
@@ -1293,7 +1293,7 @@ def ParseDevPathValue (Value):
 def ParseFieldValue (Value):\r
     if type(Value) == type(0):\r
         return Value, (Value.bit_length() + 7) / 8\r
-    if type(Value) <> type(''):\r
+    if type(Value) != type(''):\r
         raise BadExpression('Type %s is %s' %(Value, type(Value)))\r
     Value = Value.strip()\r
     if Value.startswith(TAB_UINT8) and Value.endswith(')'):\r
@@ -1327,7 +1327,7 @@ def ParseFieldValue (Value):
             Value = Value[1:-1]\r
         try:\r
             Value = "'" + uuid.UUID(Value).get_bytes_le() + "'"\r
-        except ValueError, Message:\r
+        except ValueError as Message:\r
             raise BadExpression(Message)\r
         Value, Size = ParseFieldValue(Value)\r
         return Value, 16\r