Search code examples
pythonwso2wso2-choreo

How to add python modules in WSO2 Choreo


I'm trying to create a scheduled task in WSO2 Choreo. I have written a python script for this. When I build and run the Python script i'm getting below error in Choreo

2024-02-21T05:34:10.5261302Z /layers/google.python.runtime/python/bin/python: No module named gspread.__main__  'gspread' is a package and cannot be directly executed

Its saying that its unable to find the modules that I have used in my script. I tried adding requirements.txt file with my python script but still WSO2 Choreo was not able to identify the modules.

Anyone know how to include the modules in WSO2 Choreo for python script

I tried adding requirements.txt file with my Python script but still WSO2 Choreo was not able to identify the modules.


Solution

  • I was able to resolve the issue by editing my Procfile as below

    web: pip3 install -r requirements.txt && python3 script.py
    

    Now Choreo will install the modules from the requirements.txt before it runs the script.py