Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 用Iron.io安排Twilio通话_Python_Ruby_Twilio_Iron.io - Fatal编程技术网

Python 用Iron.io安排Twilio通话

Python 用Iron.io安排Twilio通话,python,ruby,twilio,iron.io,Python,Ruby,Twilio,Iron.io,我正试图安排在特定时间打电话。以下python代码进行了调用: #Download the library from twilio.com/docs/libraries from twilio.rest import TwilioRestClient # Get these credentials from http://twilio.com/user/account account_sid = "myaccountsid" auth_token = "myauthtoken" client

我正试图安排在特定时间打电话。以下python代码进行了调用:

#Download the library from twilio.com/docs/libraries
from twilio.rest import TwilioRestClient

# Get these credentials from http://twilio.com/user/account
account_sid = "myaccountsid"
auth_token = "myauthtoken"
client = TwilioRestClient(account_sid, auth_token)

# Make the call
call = client.calls.create(to="+12345789123",  # Any phone number
                           from_="+12345789123", # Must be a valid Twilio number
                           url="http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
print call.sid
此代码是用于Iron.io的.worker:

# define the runtime language
runtime "python"

gem 'twilio-ruby'
gem 'uber_config'

# exec is the file that will be executed:
exec "makecall.py"
用这个

但是,我收到以下例外情况:

/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/code/base.rb:103:in `eval': undefined method `gem' for #<IronWorkerNG::Code::Base:0x007fd6c5008ec8> (NoMethodError)
    from (eval):4:in `block (2 levels) in initialize'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/code/base.rb:103:in `eval'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/code/base.rb:103:in `block (2 levels) in initialize'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/fetcher.rb:78:in `call'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/fetcher.rb:78:in `fetch'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/code/base.rb:93:in `block in initialize'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/code/base.rb:92:in `each'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/code/base.rb:92:in `initialize'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/cli.rb:78:in `new'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/lib/iron_worker_ng/cli.rb:78:in `upload'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_worker_ng-1.6.2/bin/iron_worker:120:in `<top (required)>'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/bin/iron_worker:23:in `load'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/bin/iron_worker:23:in `<main>'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/bin/ruby_executable_hooks:15:in `eval'
    from /Users/user/.rvm/gems/ruby-2.0.0-p598/bin/ruby_executable_hooks:15:in `<main>'
/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-ng-1.6.2/lib/iron_-worker_-ng/code/base.rb:103:in'eval:#的未定义方法'gem'(NoMethodError)
from(eval):4:in“初始化中的块(2级)”中
from/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-ng-1.6.2/lib/iron_-worker_-ng/code/base.rb:103:in'eval'
from/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-ng-1.6.2/lib/iron_-worker_-ng/code/base.rb:103:在“块(2个级别)中初始化”
from/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-ng-1.6.2/lib/iron_-worker_-ng/fetcher.rb:78:in'call'
from/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-ng-1.6.2/lib/iron_-worker_-ng/fetcher.rb:78:in'fetch'
from/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-ng-1.6.2/lib/iron_-worker_-ng/code/base.rb:93:在“初始化中的块”中
from/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-1.6.2/lib/iron_-worker_-ng/code/base.rb:92:在'each'中
from/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-1.6.2/lib/iron_-worker_-ng/code/base.rb:92:在“初始化”中
from/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-ng-1.6.2/lib/iron_-worker_-ng/cli.rb:78:in'new'
来自/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker_-ng-1.6.2/lib/iron_-worker_-ng/cli.rb:78:“上传”中
来自/Users/user/.rvm/gems/ruby-2.0.0-p598/gems/iron_-worker\u ng-1.6.2/bin/iron_-worker:120:in`'
from/Users/user/.rvm/gems/ruby-2.0.0-p598/bin/iron_-worker:23:in'load'
from/Users/user/.rvm/gems/ruby-2.0.0-p598/bin/iron_-worker:23:in`'
from/Users/user/.rvm/gems/ruby-2.0.0-p598/bin/ruby\u executable\u hooks:15:in'eval'
from/Users/user/.rvm/gems/ruby-2.0.0-p598/bin/ruby\u executable\u hooks:15:in`'

我做错了什么?

看起来您正试图使用python脚本在
.worker
文件中使用Ruby gems。您应该为Python库使用pip。尝试将
.worker
文件更改为:

runtime 'python'

# dependencies
pip 'twilio'

# executable
exec 'mycall.py'

很明显,这是一个打字错误。宝石的名字是twilio ruby,这不是我输入的吗?我是说教程有一个打字错误。也许他们是从ruby版本移植过来的。@akonsu这样做的正确方法是什么?@Apollo您运行的是什么命令导致了这个错误?谢谢。这帮了大忙