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

Improve error message when extension is not found #795

Merged
merged 2 commits into from
May 27, 2020

Conversation

mthrok
Copy link
Contributor

@mthrok mthrok commented May 27, 2020

No description provided.

@@ -32,7 +32,7 @@ def _init_extension():
extfinder = importlib.machinery.FileFinder(lib_dir, loader_details)
ext_specs = extfinder.find_spec("_torchtext")
if ext_specs is None:
raise ImportError
raise ImportError("Extension _torchtext is not found.")
Copy link
Contributor

@zhangguanheng66 zhangguanheng66 May 27, 2020

Choose a reason for hiding this comment

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

Should we be more explicit for the error message?

Copy link
Contributor Author

@mthrok mthrok May 27, 2020

Choose a reason for hiding this comment

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

I am open to your suggestion, but if the extension is not found then it most likely means that there is something wrong with installation so I am not sure what is a better message to give out.

While I was working on building torchtext on fbcode, I encountered this and raising bare ImportError without a message was more confusing because I could not tell which module is causing ImportError. so as long as it is clear that it's coming from torchtext, I am okay with any message.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about "cpp extension is not found"? something similar.

@mthrok
Copy link
Contributor Author

mthrok commented May 27, 2020

Rebased to see the effect of #796

@mthrok mthrok merged commit 3fbe4da into pytorch:master May 27, 2020
@mthrok mthrok deleted the tweak-import branch May 27, 2020 16:04
@mthrok
Copy link
Contributor Author

mthrok commented May 27, 2020

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants