Don't use bare 'except:'
They catch any exception, including KeyboardInterrupt, we don't want to catch it.
This commit is contained in:
parent
af14000215
commit
70a1165b32
8 changed files with 16 additions and 19 deletions
|
@ -75,7 +75,7 @@ def preferredencoding():
|
|||
try:
|
||||
pref = locale.getpreferredencoding()
|
||||
'TEST'.encode(pref)
|
||||
except:
|
||||
except Exception:
|
||||
pref = 'UTF-8'
|
||||
|
||||
return pref
|
||||
|
@ -127,7 +127,7 @@ def write_json_file(obj, fn):
|
|||
except OSError:
|
||||
pass
|
||||
os.rename(tf.name, fn)
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
os.remove(tf.name)
|
||||
except OSError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue