Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.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
Ruby 此脚本无法编译,但原因是什么?_Ruby_String_Twitter_Quotes_Double Quotes - Fatal编程技术网

Ruby 此脚本无法编译,但原因是什么?

Ruby 此脚本无法编译,但原因是什么?,ruby,string,twitter,quotes,double-quotes,Ruby,String,Twitter,Quotes,Double Quotes,此ruby脚本不运行。它的反应是 /Users/superhappyfuntime/Desktop/twt.rb:25: undefined local variable or method `xsFEEyGKDPcnhJ5JoPJKg' for main:Object (NameError) from /Library/Ruby/Gems/1.8/gems/twitter-1.7.2/lib/twitter/configuration.rb:80:in `configure' from /Us

此ruby脚本不运行。它的反应是

/Users/superhappyfuntime/Desktop/twt.rb:25: undefined local variable or method `xsFEEyGKDPcnhJ5JoPJKg' for main:Object (NameError)
from /Library/Ruby/Gems/1.8/gems/twitter-1.7.2/lib/twitter/configuration.rb:80:in `configure'
from /Users/superhappyfuntime/Desktop/twt.rb:24 
这是在用户输入之后

我怎么修理它?此外,如果有帮助,以下是脚本:

#!/usr/bin/ruby

require "rubygems"
require "twitter"


puts "Welcome! TwitNIX (A.K.A. 'clt') posts to Twitter from the command line!"


puts "your token, please:"

please = gets.chomp




puts "...aaand your secret_token:"

secret_token = gets.chomp

puts "You're Done!"


Twitter.configure do |config|
 config.consumer_key = xsFEEyGKDPcnhJ5JoPJKg
 config.consumer_secret = **CENSORED**
 config.oauth_token = please 
 config.oauth_token_secret = secret_token
 end


client = Twitter::Client.new



puts "Now,  post an update:"

update = gets

client.update("update")


puts "Now, post an update:"

update = gets

client.update("update")
一旦这是固定的,我的pogram应该做。请帮忙

更新:现在显示:

/Library/Ruby/Gems/1.8/gems/twitter-1.7.2/lib/faraday/response/raise_http_4xx.rb:12:in `on_complete': POST https://api.twitter.com/1/statuses/update.json: 401: Read-only application cannot POST (Twitter::Unauthorized)
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.5/lib/faraday/response.rb:9:in `call'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.5/lib/faraday/response.rb:62:in `on_complete'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.5/lib/faraday/response.rb:8:in `call'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.5/lib/faraday/request/url_encoded.rb:14:in `call'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.5/lib/faraday/request/multipart.rb:13:in `call'
    from /Library/Ruby/Gems/1.8/gems/twitter-1.7.2/lib/faraday/request/twitter_oauth.rb:17:in `call'
    from /Library/Ruby/Gems/1.8/gems/twitter-1.7.2/lib/faraday/request/multipart_with_file.rb:18:in `call'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.5/lib/faraday/connection.rb:207:in `run_request'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.5/lib/faraday/connection.rb:94:in `post'
    from /Library/Ruby/Gems/1.8/gems/twitter-1.7.2/lib/twitter/request.rb:27:in `send'
    from /Library/Ruby/Gems/1.8/gems/twitter-1.7.2/lib/twitter/request.rb:27:in `request'
    from /Library/Ruby/Gems/1.8/gems/twitter-1.7.2/lib/twitter/request.rb:10:in `post'
    from /Library/Ruby/Gems/1.8/gems/twitter-1.7.2/lib/twitter/client/tweets.rb:45:in `update'
    from /Users/superhappyfuntime/Desktop/twt.rb:40
''
单引号添加到字符串

Twitter.configure do |config|
 config.consumer_key = 'xsFEEyGKDPcnhJ5JoPJKg'
 config.consumer_secret = '**CENSORED**'

您可以更好地重置您的twitter用户密钥和密码

www.ning.com/help/?p=5551

最好不要向所有人展示一些敏感信息:)你真的要在这里发布你的密钥吗???此外,请注意,已经有一个名为twt的gem安装了一个名为twt的clitwitter接口。使用
gem instal twt
安装。有关第二个
401:Read-only
错误,请访问GitHub开发者站点并启用读写访问。