diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-18 20:02:39 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-18 20:02:39 (GMT) |
commit | ad28c7f9dad791567afa0624acfb3ba430851965 (patch) | |
tree | 02095e5f567d6be1de31ffd858d21233b51675dd /Lib/platform.py | |
parent | a19195984922ce89e7695c93b3bb45c3e0e6d732 (diff) | |
download | cpython-ad28c7f9dad791567afa0624acfb3ba430851965.zip cpython-ad28c7f9dad791567afa0624acfb3ba430851965.tar.gz cpython-ad28c7f9dad791567afa0624acfb3ba430851965.tar.bz2 |
Issue #16706: get rid of os.error
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-x | Lib/platform.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/platform.py b/Lib/platform.py index db08eab..5629691 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -316,7 +316,7 @@ def linux_distribution(distname='', version='', id='', """ try: etc = os.listdir('/etc') - except os.error: + except OSError: # Probably not a Unix system return distname,version,id etc.sort() @@ -424,10 +424,10 @@ def _syscmd_ver(system='', release='', version='', pipe = popen(cmd) info = pipe.read() if pipe.close(): - raise os.error('command failed') + raise OSError('command failed') # XXX How can I suppress shell errors from being written # to stderr ? - except os.error as why: + except OSError as why: #print 'Command %s failed: %s' % (cmd,why) continue except IOError as why: @@ -906,7 +906,7 @@ def _syscmd_uname(option,default=''): return default try: f = os.popen('uname %s 2> %s' % (option, DEV_NULL)) - except (AttributeError,os.error): + except (AttributeError, OSError): return default output = f.read().strip() rc = f.close() @@ -932,7 +932,7 @@ def _syscmd_file(target,default=''): proc = subprocess.Popen(['file', target], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - except (AttributeError,os.error): + except (AttributeError, OSError): return default output = proc.communicate()[0].decode('latin-1') rc = proc.wait() |