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

nltk stopwords silent download error #273

Open
nsmarks opened this issue Jun 24, 2022 · 0 comments
Open

nltk stopwords silent download error #273

nsmarks opened this issue Jun 24, 2022 · 0 comments

Comments

@nsmarks
Copy link

nsmarks commented Jun 24, 2022

In https://github.com/stanford-oval/genienlp/blob/master/genienlp/ned/ned_utils.py#L38, if the download of nltk stopwords fails, it does so silently. The quiet flag suppresses errors.

Error seen:

>>> nltk.download('stopwords')
[nltk_data] Error loading stopwords: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data]     unable to get local issuer certificate (_ssl.c:1131)>
False

Solution from https://stackoverflow.com/questions/38916452/nltk-download-ssl-certificate-verify-failed:

import nltk
import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    pass
else:
    ssl._create_default_https_context = _create_unverified_https_context

nltk.download('stopwords')
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

No branches or pull requests

1 participant