summaryrefslogtreecommitdiff
path: root/examples/menuconfig_example.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2019-07-01 22:52:17 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2019-07-02 00:03:02 +0200
commite5e2fe5a6f084fb98c2c9b4adec0383fec4a5256 (patch)
treec0670e6a3d7ced09a403e0ae0b0c60c2ffc21375 /examples/menuconfig_example.py
parent5be5bfbc401a4e3021198145e8b7c9a70f0fae5c (diff)
Catch EnvironmentError instead of OSError/IOError
menuconfig.py tended to crash on I/O errors on Python 2, due to forgetting to update some 'except OSError's. Catch EnvironmentError instead. EnvironmentError is a common base class of IOError and OSError on Python 2, and an alias for OSError on Python 3. Use it elsewhere too, as it might help catch obscure I/O errors on Python 2.
Diffstat (limited to 'examples/menuconfig_example.py')
-rwxr-xr-xexamples/menuconfig_example.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/menuconfig_example.py b/examples/menuconfig_example.py
index 2c98fff..a06b05e 100755
--- a/examples/menuconfig_example.py
+++ b/examples/menuconfig_example.py
@@ -305,7 +305,7 @@ if __name__ == "__main__":
try:
# Returns a message telling which file got loaded
print(kconf.load_config(config_filename))
- except IOError as e:
+ except EnvironmentError as e:
print(e, file=sys.stderr)
print_menuconfig(kconf)
@@ -316,7 +316,7 @@ if __name__ == "__main__":
try:
# Returns a message telling which file got saved
print(kconf.write_config(config_filename))
- except IOError as e:
+ except EnvironmentError as e:
print(e, file=sys.stderr)
continue