Ruby end of file reached 的问题一般是什么原因引起?

freemem · 2012年05月02日 · 最后由 freemem 回复于 2012年05月03日 · 13585 次阅读
rake aborted!
end of file reached
/usr/local/ruby/lib/ruby/1.8/net/protocol.rb:135:in `sysread'
/usr/local/ruby/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
/usr/local/ruby/lib/ruby/1.8/timeout.rb:62:in `timeout'
/usr/local/ruby/lib/ruby/1.8/timeout.rb:93:in `timeout'
/usr/local/ruby/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
/usr/local/ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
/usr/local/ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline'
/usr/local/ruby/lib/ruby/1.8/net/http.rb:2020:in `read_status_line'
/usr/local/ruby/lib/ruby/1.8/net/http.rb:2009:in `read_new'
/usr/local/ruby/lib/ruby/1.8/net/http.rb:1050:in `request'
/usr/local/ruby/lib/ruby/1.8/net/http.rb:1037:in `request'
/usr/local/ruby/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/local/ruby/lib/ruby/1.8/net/http.rb:1035:in `request'
/usr/local/ruby/lib/ruby/1.8/net/http.rb:772:in `get'
/usr/local/ruby/lib/ruby/gems/1.8/gems/faraday-0.8.0/lib/faraday/adapter/net_http.rb:70:in `perform_request'
/usr/local/ruby/lib/ruby/gems/1.8/gems/faraday-0.8.0/lib/faraday/adapter/net_http.rb:35:in `call'
/usr/local/ruby/lib/ruby/gems/1.8/gems/faraday-0.8.0/lib/faraday/request/url_encoded.rb:14:in `call'
/usr/local/ruby/lib/ruby/gems/1.8/gems/faraday-0.8.0/lib/faraday/connection.rb:226:in `run_request'
/usr/local/ruby/lib/ruby/gems/1.8/gems/oauth2-0.5.2/lib/oauth2/client.rb:88:in `request'
/usr/local/ruby/lib/ruby/gems/1.8/gems/oauth2-0.5.2/lib/oauth2/access_token.rb:98:in `request'
/usr/local/ruby/lib/ruby/gems/1.8/gems/weibo2-0.1.0/lib/weibo2/interface/base.rb:15:in `request'
/usr/local/ruby/lib/ruby/gems/1.8/gems/weibo2-0.1.0/lib/weibo2/interface/base.rb:23:in `get'
/usr/local/ruby/lib/ruby/gems/1.8/gems/weibo2-0.1.0/lib/weibo2/interface/statuses.rb:67:in `user_timeline'
/root/rss/rakefile.rb:28
/root/rss/rakefile.rb:26:in `each'
/root/rss/rakefile.rb:26
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/local/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/ruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/local/ruby/bin/rake:19:in `load'
/usr/local/ruby/bin/rake:19

看看那个文件最后缺少个 end 什么的

可能要贴文件内容呢

已解决,EOFError,使用 open(url) 时,可能由于超时获其他什么原因,导致文档未取回,在解析时出错。用 rescue 捕捉错误并重试就好了。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号