简体   繁体   中英

How to load a python module into codestar

Hi I am getting below error when deploying python to lambda codestar

Could somebody help me?

[Container] 2019/07/11 21:15:54 Running command . venv/bin/activate 

[Container] 2019/07/11 21:15:54 Running command python -m nltk.downloader wordnet 
/usr/local/lib/python3.7/runpy.py:125: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour 
  warn(RuntimeWarning(msg)) 
[nltk_data] Error loading wordnet: <urlopen error [SSL: 
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
[nltk_data]     unable to get local issuer certificate (_ssl.c:1051)> 
Error installing package. Retry? [n/y/e] 
Traceback (most recent call last): 
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main 
    "__main__", mod_spec) 
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code 
    exec(code, run_globals) 
  File "/codebuild/output/src147142456/src/venv/lib/python3.7/site-packages/nltk/downloader.py", line 2583, in <module> 
    halt_on_error=options.halt_on_error, 
  File "/codebuild/output/src147142456/src/venv/lib/python3.7/site-packages/nltk/downloader.py", line 798, in download 
    choice = input().strip() 
EOFError: EOF when reading a line

After some research I had to manually download the modules and save them into nltk_data then in my lambda i created an environment variable NLTK_DATA with value ./nltk_data

Check the best answer in this post:

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

Another thing is in the below post: this command enables https python -m nltk.downloader -u https://pastebin.com/raw/D3TBY4Mj all

https://github.com/nltk/nltk/issues/1787

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM