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

MAINT: clearer exception message when importing multiarray fails. #7637

Merged
merged 1 commit into from
May 14, 2016

Conversation

rgommers
Copy link
Member

This regularly confuses users, see for example gh-5529.

The path via which the multiarray import is reached has changed a few times
in the last couple of years, but multiarray is always the first extension
module to be imported, so this looks like a reasonable place to add the
message.

This regularly confuses users, see for example numpygh-5529.

The path via which the multiarray import is reached has changed a few times
in the last couple of years, but multiarray is always the first extension
module to be imported, so this looks like a reasonable place to add the
message.
try:
from . import multiarray
except ImportError:
msg = """
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be usefull someday to have a format_message function that would remove prefixed spaces so we could make these messages look better. IIRC @pv had, or knew of, a function that did that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

textwrap.dedent does that, I'm not aware of something fancier. but yes, may be useful especially for longer strings.

@charris charris merged commit 524e3ec into numpy:master May 14, 2016
@charris
Copy link
Member

charris commented May 14, 2016

Thanks Ralf, and welcome back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants