简体   繁体   English

IO:Class的Ruby未定义方法`binwrite'(NoMethodError)

[英]Ruby undefined method `binwrite' for IO:Class (NoMethodError)

Lately I get a very strange error at the following line of code: 最近,我在下面的代码行中遇到一个非常奇怪的错误:

IO.binwrite(attachmentUploadFile, attachmentFileContent)

This is the full error message: 这是完整的错误消息:

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>'

It worked perfectly before. 以前效果很好。 I haven't changed anything in my configuration. 我的配置没有任何更改。 I know there IS a method 'binwrite' for IO:Class. 我知道 IO:Class 一个方法'binwrite'。

Any ideas? 有任何想法吗?

I suspect your Ruby interpreter in your environment has is not the version which you expect. 我怀疑您环境中的Ruby解释器不是您期望的版本。

You've linked to 1.9.3 documentation that supports the binwrite() method, but if I look at the path in your error message, I see a 1.9.2 version, and it doesn't look like 1.9.2 supports that method from what I can see. 您已链接到支持binwrite()方法的1.9.3文档,但是如果查看错误消息中的路径,则会看到1.9.2版本,而1.9.2版本似乎不支持该方法。从我所看到的。 Maybe ask your Ruby interpreter what version it is and upgrade if necessary? 也许问您的Ruby解释器是什么版本,并在必要时进行升级?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM