简体   繁体   中英

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.

Any ideas?

I suspect your Ruby interpreter in your environment has is not the version which you expect.

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. Maybe ask your Ruby interpreter what version it is and upgrade if necessary?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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