diff hgext/convert/common.py @ 49306:2e726c934fcd

py3: catch FileNotFoundError instead of checking errno == ENOENT
author Manuel Jacob <me@manueljacob.de>
date Tue, 31 May 2022 22:50:01 +0200
parents ef5f5f1cbd90
children faccec1edc2c
line wrap: on
line diff
--- a/hgext/convert/common.py	Tue May 31 21:16:17 2022 +0200
+++ b/hgext/convert/common.py	Tue May 31 22:50:01 2022 +0200
@@ -7,7 +7,6 @@
 
 import base64
 import datetime
-import errno
 import os
 import pickle
 import re
@@ -528,9 +527,7 @@
             return
         try:
             fp = open(self.path, b'rb')
-        except IOError as err:
-            if err.errno != errno.ENOENT:
-                raise
+        except FileNotFoundError:
             return
         for i, line in enumerate(fp):
             line = line.splitlines()[0].rstrip()