Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG, DIST: Print os error message when the executable not exist #20463

Merged
merged 1 commit into from Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions numpy/distutils/ccompiler.py
Expand Up @@ -143,12 +143,18 @@ def CCompiler_spawn(self, cmd, display=None):
except subprocess.CalledProcessError as exc:
o = exc.output
s = exc.returncode
except OSError:
except OSError as e:
# OSError doesn't have the same hooks for the exception
# output, but exec_command() historically would use an
# empty string for EnvironmentError (base class for
# OSError)
o = b''
# o = b''
# still that would make the end-user lost in translation!
o = f"\n\n{e}\n\n\n"
try:
o = o.encode(sys.stdout.encoding)
except AttributeError:
o = o.encode('utf8')
# status previously used by exec_command() for parent
# of OSError
s = 127
Expand Down
4 changes: 2 additions & 2 deletions numpy/distutils/ccompiler_opt.py
Expand Up @@ -708,8 +708,8 @@ def _dist_test_spawn(cmd, display=None):
except subprocess.CalledProcessError as exc:
o = exc.output
s = exc.returncode
except OSError:
o = b''
except OSError as e:
o = e
s = 127
else:
return None
Expand Down