首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Iron.io安排两次调用

用Iron.io安排两次调用
EN

Stack Overflow用户
提问于 2015-01-18 19:43:11
回答 1查看 176关注 0票数 1

我正试图在某个特定的时间安排一个电话。下面的python代码进行调用:

代码语言:javascript
复制
#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

这段代码是一个用于.worker的Iron.io:

代码语言:javascript
复制
# define the runtime language
runtime "python"

gem 'twilio-ruby'
gem 'uber_config'

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

使用这个教程

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

代码语言:javascript
复制
/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>'

我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-19 19:54:37

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

代码语言:javascript
复制
runtime 'python'

# dependencies
pip 'twilio'

# executable
exec 'mycall.py'
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28014005

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档