2012-07-31 43 views
0

最近我在下面的行的代码得到一个非常奇怪的错误:红宝石未定义的方法`binwrite”的IO:类(NoMethodError)

IO.binwrite(attachmentUploadFile, attachmentFileContent) 

这是完整的错误消息:

import.rb:326:in `block (3 levels) in <main>': undefined method `binwrite' for IO:Class (NoMethodError) 
from /Users/juuro/.rvm/gems/ruby-1.9.2-p290/gems/zippy-0.2.1/lib/zippy.rb:144:in `open' 
from import.rb:321:in `block (2 levels) in <main>' 
from import.rb:320:in `each' 
from import.rb:320:in `block in <main>' 
from import.rb:167:in `each' 
from import.rb:167:in `<main>' 

它之前的工作完美。我没有改变我的配置中的任何东西。 I know there IS的方法 'binwrite' 的IO:类。

任何想法?

+0

'ruby -v'的输出是什么? – Linuxios 2012-07-31 23:22:08

回答

1

我怀疑你的Ruby解释器在您的环境是不是你所期望的版本。

您已链接到支持binwrite()方法的1.9.3文档,但如果我查看错误消息中的路径,则会看到1.9.2版本,而且看起来不像1.9。 2支持从我所看到的that method。也许问你的Ruby解释器是什么版本,如果需要升级?

+0

感谢我更新到1.9.3红宝石。现在它(再次)起作用。我认为它有一些待办事项与更新至OS X山狮。虽然我确信它已经安装了Mountain Lion。 – Juuro 2012-08-01 01:11:19

相关问题