我有一个 Twilio CLI 命令,我希望在 Raspberry Pi 上使用 Python os.system() 运行它,但是它不能正常运行......说它遇到错误。
我也不明白调试消息...
当前代码如下所示:
command_string = '/home/pi/.config/nvm/versions/node/v16.13.1/bin/twilio phone-numbers:update ' +my_number+ ' --sms-url=http://localhost:5000 -l debug'
os.system(command_string)
Python 脚本运行良好,但我不断收到上述命令的以下结果:
[DEBUG] Config File: /root/.twilio-cli/config.json
[DEBUG] Using profile: ${TWILIO_ACCOUNT_SID}/${TWILIO_AUTH_TOKEN}
[DEBUG] -- BEGIN Twilio API Request --
[DEBUG] GET https://api.twilio.com/2010-04-01/Accounts/TWILIO_ACCOUNT_SID/IncomingPhoneNumbers.json
[DEBUG] Querystring:
[DEBUG] {"PhoneNumber":"NUMBER"}
[DEBUG] Custom HTTP Headers:
[DEBUG] User-Agent: twilio-cli/2.35.0 @twilio/cli-core/5.32.2 (linux arm) twilio-node/3.71.3 node/v16.13.0 phone-numbers:update
[DEBUG] -- END Twilio API Request --
[DEBUG] response.statusCode: 200
[DEBUG] response.headers: {"date":"Sun, 12 Dec 2021 19:03:24 GMT","content-type":"application/json; charset=utf-8","content-length":"1585","connection":"close","twilio-concurrent-requests":"1","twilio-request-id":"RQ1c8c8551e33b2b8efaf2a3e93ce84050","twilio-request-duration":"1.085","access-control-allow-origin":"*","access-control-allow-headers":"Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since","access-control-allow-methods":"GET, POST, DELETE, OPTIONS","access-control-expose-headers":"ETag","access-control-allow-credentials":"true","x-powered-by":"AT-5000","x-shenanigans":"none","x-home-region":"us1","x-api-domain":"api.twilio.com","strict-transport-security":"max-age=31536000"}
[DEBUG] Found command "phone-numbers:update" plugin: twilio-cli
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=info msg="no configuration paths supplied"
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=info msg="ignoring default config path, could not stat it" path=/root/.ngrok2/ngrok.yml err="stat /root/.ngrok2/ngrok.yml: no such file or directory"
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=info msg=start pg=/api/tunnels id=9ba04b3a3b59fd8f
t=2021-12-13T03:03:25+0800 lvl=warn msg="ngrok is not yet ready to start tunnels" pg=/api/tunnels id=9ba04b3a3b59fd8f err="a successful ngrok tunnel session has not yet been established"
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=info msg=end pg=/api/tunnels id=9ba04b3a3b59fd8f status=503 dur=1.646498ms
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=info msg=start pg=/api/tunnels id=38085fdc657c6c64
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=warn msg="ngrok is not yet ready to start tunnels" pg=/api/tunnels id=38085fdc657c6c64 err="a successful ngrok tunnel session has not yet been established"
t=2021-12-13T03:03:25+0800 lvl=info msg=end pg=/api/tunnels id=38085fdc657c6c64 status=503 dur=829.471µs
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=info msg=start pg=/api/tunnels id=1d29d31d96b0c316
t=2021-12-13T03:03:25+0800 lvl=warn msg="ngrok is not yet ready to start tunnels" pg=/api/tunnels id=1d29d31d96b0c316 err="a successful ngrok tunnel session has not yet been established"
t=2021-12-13T03:03:25+0800 lvl=info msg=end pg=/api/tunnels id=1d29d31d96b0c316 status=503 dur=494.549µs
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=info msg=start pg=/api/tunnels id=541085ca341447c1
[DEBUG] ngrok: t=2021-12-13T03:03:25+0800 lvl=warn msg="ngrok is not yet ready to start tunnels" pg=/api/tunnels id=541085ca341447c1 err="a successful ngrok tunnel session has not yet been established"
t=2021-12-13T03:03:25+0800 lvl=info msg=end pg=/api/tunnels id=541085ca341447c1 status=503 dur=900.748µs
[DEBUG] ngrok: t=2021-12-13T03:03:26+0800 lvl=info msg=start pg=/api/tunnels id=894e9ee1a0583b59
[DEBUG] ngrok: t=2021-12-13T03:03:26+0800 lvl=info msg="tunnel session started" obj=tunnels.session
t=2021-12-13T03:03:26+0800 lvl=info msg="client session established" obj=csess id=fe7aff6afc5d
[DEBUG] ngrok: t=2021-12-13T03:03:26+0800 lvl=warn msg="failed to start tunnel" pg=/api/tunnels id=894e9ee1a0583b59 err="You must signup for ngrok and add your authtoken to perform this operation.\n\nSign up for an account: https://dashboard.ngrok.com/signup\nInstall your authoken: https://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_4018\r\n"
[DEBUG] ngrok: t=2021-12-13T03:03:26+0800 lvl=info msg=end pg=/api/tunnels id=894e9ee1a0583b59 status=502 dur=391.989355ms
[DEBUG] Found command "phone-numbers:update" plugin: twilio-cli
» twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: "https://github.com/twilio/twilio-cli/issues"
[DEBUG] Converting circular structure to JSON
--> starting at object with constructor 'Socket'
| property '_httpMessage' -> object with constructor 'ClientRequest'
--- property 'socket' closes the circle
[DEBUG] TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Socket'
| property '_httpMessage' -> object with constructor 'ClientRequest'
--- property 'socket' closes the circle
at JSON.stringify (<anonymous>)
at NumberUpdate.createTunnel (/home/pi/.config/nvm/versions/node/v16.13.1/lib/node_modules/twilio-cli/src/commands/phone-numbers/update.js:94:51)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async NumberUpdate.run (/home/pi/.config/nvm/versions/node/v16.13.1/lib/node_modules/twilio-cli/src/commands/phone-numbers/update.js:48:9)
at async NumberUpdate._run (/home/pi/.config/nvm/versions/node/v16.13.1/lib/node_modules/twilio-cli/node_modules/@oclif/command/lib/command.js:43:20)
at async Config.runCommand (/home/pi/.config/nvm/versions/node/v16.13.1/lib/node_modules/twilio-cli/node_modules/@oclif/config/lib/config.js:173:24)
at async Main.run (/home/pi/.config/nvm/versions/node/v16.13.1/lib/node_modules/twilio-cli/node_modules/@oclif/command/lib/main.js:27:9)
at async Main._run (/home/pi/.config/nvm/versions/node/v16.13.1/lib/node_modules/twilio-cli/node_modules/@oclif/command/lib/command.js:43:20)
结果,我无法接收来自 Twilio 的短信...
关于如何使这项工作的任何想法?