I wish to run the following command using the Twilio CLI from Python:
ngrok_cmd = "twilio phone-numbers:update "+ my_number " --sms url=https://localhost:5000"
os.system(ngrok_cmd)
The command works on the terminal, but doesn't if I try to do it through python. It keeps giving the following error:
sh: 1: twilio: not found
EDIT:
I tried this:
ngrok_cmd = "/home/pi/.config/nvm/versions/node/v16.13.1/bin/twilio phone-numbers:update "+ my_number " --sms url=http://localhost:5000"
os.system(ngrok_cmd)
now I get this error:
» Could not find profile.
» To create the profile, run:
twilio profiles:create
Alternatively, twilio-cli can use credentials stored in environment variables:
# OPTION 1 (recommended)
export TWILIO_ACCOUNT_SID=your Account SID from twil.io/console
export TWILIO_API_KEY=an API Key created at twil.io/get-api-key
export TWILIO_API_SECRET=the secret for the API Key
# OPTION 2
export TWILIO_ACCOUNT_SID=your Account SID from twil.io/console
export TWILIO_AUTH_TOKEN=your Auth Token from twil.io/console
Once these environment variables are set, a twilio-cli profile is not required and you may skip the "login" step.
However, I have already set the environmental variables in /etc/profile and verified it with:
printenv | grep TWI
I do not know what is the cause of this error. Can anyone help me with this?