-
Notifications
You must be signed in to change notification settings - Fork 813
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
Conversation
torchtext/__init__.py
Outdated
@@ -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.") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Rebased to see the effect of #796 |
Thanks! |
No description provided.