Iconv not found with latest versions of dependencies

270 views
Skip to first unread message

Petteri Räty

unread,
Jun 25, 2012, 5:30:34 AM6/25/12
to ruby...@googlegroups.com
After bundle update roo I get:

$ irb
1.9.3p125 :001 > require 'rubygems'
 => false 
1.9.3p125 :002 > require 'roo'
 => true 
1.9.3p125 :003 > Roo::Spreadsheet.open 'file.xls'
NameError: uninitialized constant Excel::Iconv
from /Users/betelgeuse/.rvm/gems/ruby-1.9.3-p125/gems/roo-1.10.1/lib/roo/excel.rb:284:in `platform_specific_iconv'
from /Users/betelgeuse/.rvm/gems/ruby-1.9.3-p125/gems/roo-1.10.1/lib/roo/excel.rb:277:in `normalize_string'
from /Users/betelgeuse/.rvm/gems/ruby-1.9.3-p125/gems/roo-1.10.1/lib/roo/excel.rb:139:in `block in sheets'
from /Users/betelgeuse/.rvm/gems/ruby-1.9.3-p125/gems/roo-1.10.1/lib/roo/excel.rb:139:in `collect'
from /Users/betelgeuse/.rvm/gems/ruby-1.9.3-p125/gems/roo-1.10.1/lib/roo/excel.rb:139:in `sheets'
from /Users/betelgeuse/.rvm/gems/ruby-1.9.3-p125/gems/roo-1.10.1/lib/roo/excel.rb:123:in `initialize'
from /Users/betelgeuse/.rvm/gems/ruby-1.9.3-p125/gems/roo-1.10.1/lib/roo.rb:52:in `new'
from /Users/betelgeuse/.rvm/gems/ruby-1.9.3-p125/gems/roo-1.10.1/lib/roo.rb:52:in `open'
from (irb):3
from /Users/betelgeuse/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `<main>'

Andrew Vit

unread,
Jan 11, 2013, 3:45:35 PM1/11/13
to ruby...@googlegroups.com
On Monday, June 25, 2012 2:30:34 AM UTC-7, Petteri Räty wrote:
After bundle update roo I get:

$ irb
1.9.3p125 :001 > require 'rubygems'
 => false 
1.9.3p125 :002 > require 'roo'
 => true 
1.9.3p125 :003 > Roo::Spreadsheet.open 'file.xls'
NameError: uninitialized constant Excel::Iconv

Hi, I had the same problem: the Roo::Excel class will use Iconv on darwin and solaris platforms, and it needs to be required manually. This fixes it:

    require 'iconv'

Couple of points:

1. Roo should call it as ::Iconv from the root namespace, so it gives a cleaner error
2. Ideally it should get installed automatically with the roo gem based on the platform, I think this is how, but I've never done it before: http://en.wikibooks.org/wiki/Ruby_Programming/RubyGems#How_to_install_different_versions_of_gems_depending_on_which_version_of_ruby_the_installee_is_using
 
Reply all
Reply to author
Forward
0 new messages