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
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
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
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
Value = Value[1:-1]\r
try:\r
Value = "'" + uuid.UUID(Value).get_bytes_le() + "'"\r
- except ValueError, Message:\r
- raise BadExpression('%s' % Message)\r
+ except ValueError as Message:\r
+ raise BadExpression(Message)\r
Value, Size = ParseFieldValue(Value)\r
return Value, 16\r
if Value.startswith('L"') and Value.endswith('"'):\r