]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Library/UniClassObject.py
BaseTools: Refactor python except statements
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Library / UniClassObject.py
index 7dcf0cf6558b84717f543216163f317d39fb6ea3..299cd871444b0614b4d30e74841e8bb70496d246 100644 (file)
@@ -327,9 +327,9 @@ class UniFileClassObject(object):
         if len(Lang) != 3:\r
             try:\r
                 FileIn = codecs.open(File.Path, mode='rb', encoding='utf_8').readlines()\r
-            except UnicodeError, Xstr:\r
+            except UnicodeError as Xstr:\r
                 FileIn = codecs.open(File.Path, mode='rb', encoding='utf_16').readlines()\r
-            except UnicodeError, Xstr:\r
+            except UnicodeError as Xstr:\r
                 FileIn = codecs.open(File.Path, mode='rb', encoding='utf_16_le').readlines()\r
             except:\r
                 EdkLogger.Error("Unicode File Parser", \r
@@ -436,7 +436,7 @@ class UniFileClassObject(object):
 \r
         try:\r
             FileIn = codecs.open(File.Path, mode='rb', encoding='utf_8').readlines()\r
-        except UnicodeError, Xstr:\r
+        except UnicodeError as Xstr:\r
             FileIn = codecs.open(File.Path, mode='rb', encoding='utf_16').readlines()\r
         except UnicodeError:\r
             FileIn = codecs.open(File.Path, mode='rb', encoding='utf_16_le').readlines()\r
@@ -1042,7 +1042,7 @@ class UniFileClassObject(object):
                              ExtraData=FilaPath)\r
         try:\r
             FileIn = codecs.open(FilaPath, mode='rb', encoding='utf_8').readlines()\r
-        except UnicodeError, Xstr:\r
+        except UnicodeError as Xstr:\r
             FileIn = codecs.open(FilaPath, mode='rb', encoding='utf_16').readlines()\r
         except UnicodeError:\r
             FileIn = codecs.open(FilaPath, mode='rb', encoding='utf_16_le').readlines()\r