Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with Ruby 3 #551

Closed
dcangulo opened this issue Dec 5, 2020 · 17 comments
Closed

Not compatible with Ruby 3 #551

dcangulo opened this issue Dec 5, 2020 · 17 comments

Comments

@dcangulo
Copy link

dcangulo commented Dec 5, 2020

Steps to reproduce

test.csv

test,test
test2,test2

test.rb

require 'roo'
csv = Roo::CSV.new('test.csv')
puts csv.last_row

Issue

Works with Ruby 2.7.2.

Error with Ruby 3.0.0 Preview 1

/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/csv.rb:1391:in `initialize': no implicit conversion of Hash into String (TypeError)
	from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/csv.rb:1391:in `open'
	from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/csv.rb:1391:in `open'
	from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/csv.rb:1175:in `foreach'
	from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/roo-2.8.3/lib/roo/csv.rb:96:in `each_row'
	from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/roo-2.8.3/lib/roo/csv.rb:71:in `read_cells'
	from /Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/roo-2.8.3/lib/roo/base.rb:119:in `block (2 levels) in <class:Base>'
	from test.rb:3:in `<main>'

System configuration

Roo version:

gem 'roo', '~> 2.8', '>= 2.8.3'

Ruby version:

  • ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19] (works)
  • ruby 3.0.0preview1 (2020-09-25 master 0096d2b895) [x86_64-darwin19] (doesn't work)
@jonspalmer
Copy link

Seconding the need for this fix now that Ruby 3.0 is released

@donv
Copy link
Contributor

donv commented Feb 3, 2021

It seems master is compatible. Maybe release a new version?

@b-kaczor
Copy link

any chances of releasing update soon?

@pioz
Copy link

pioz commented Feb 24, 2021

Same problem here!

@larskanis
Copy link

Thanks for fixing this issue on the master branch! However could you please release a new bugfix version?

@uzian
Copy link

uzian commented Apr 14, 2021

@larskanis please pardon my ignorance, but where is the fix 'on the master branch' that you are mentioning? At this moment I can use anything, to be honest, this issue is impacting live services of my application :(

@larskanis
Copy link

@uzian Commit 22d9930 fixes compatibility with Ruby-3.0.

@erikbrannstrom
Copy link

In case this helps someone, you are able to use the patched code by fetching a specific commit rather than a released gem:

# Until Roo releases a new version containing a fix for Ruby 2.7 deprecation warnings,
# we need to fetch the source directly from GitHub. (https://github.com/roo-rb/roo)
gem "roo", git: "https://github.com/roo-rb/roo.git", ref: "868d4ea419cf393c9d8832838d96c82e47116d2f"

@diam
Copy link

diam commented Aug 18, 2021

In case this helps someone, you are able to use the patched code by fetching a specific commit rather than a released gem:

# Until Roo releases a new version containing a fix for Ruby 2.7 deprecation warnings,
# we need to fetch the source directly from GitHub. (https://github.com/roo-rb/roo)
gem "roo", git: "https://github.com/roo-rb/roo.git", ref: "868d4ea419cf393c9d8832838d96c82e47116d2f"

Thank you Erik, but how can I add this commit version of Roo (or the master one) to the global gem system with the unix gem command line tool? (from Ruby-3.0.2)
-- Maurice

@erikbrannstrom
Copy link

@diam I've never done that, but I'd try either to build the gem yourself and install it or use the specific_install gem.

@diam
Copy link

diam commented Aug 19, 2021

Thanks Erik, I didn't know the specific_install gem extension!
So the following commands solved the problem:

gem uninstall roo
gem install specific_install
gem specific_install -l https://github.com/roo-rb/roo.git -r 868d4

-- Maurice

Edit: but I don't know what would happen if I did a gem update or something like that. So an update to the official gem would be welcome ;-)

@jasonperrone
Copy link

This gem is a dependency of other gems like simple-spreadsheet so a proper release is in order.

@svoop
Copy link

svoop commented Mar 19, 2022

@simonoff Any chance you could initiate a patchlevel release containing the fix mentioned above? It's sad to see this useful have test suites turn red for so many – even more so since the fix will soon celebrate it's first anniversary. Thanks a bunch!

@simonoff
Copy link
Member

Wow. Let me check please.
I'm sorry I'm little bit get our due to the situation in Ukraine from where i'm originally.

@svoop
Copy link

svoop commented Mar 19, 2022

OT: I feel you, been working all week on our little studio to prep it for war refugees from UA.

@simonoff
Copy link
Member

@svoop Done!

@svoop
Copy link

svoop commented Mar 19, 2022

@simonoff Thanks a lot... and мир Україні зараз!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests