I'm trying to use this gem: csv2json (0.3.0) and I'm getting an error.
On my file essaie.rb:
require 'csv2json'
File.open('essaie.csv', 'r') do |input|
File.open('output.json', 'w') do |output|
CSV2JSON.parse(input, output)
end
end
user#user-ThinkPad-L430:~/development/public/opendata/other$ ruby essaie.rb
/home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- orderedhash (LoadError)
from /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/user/.rvm/gems/ruby-2.1.0/gems/csv2json-0.3.0/lib/csv2json.rb:4:in `<top (required)>'
from /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
from /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from essaie.rb:1:in `<main>'
When I remove the version 0.3.0(csv2json) and I installed the previous version I'm getting this error:
user#user-ThinkPad-L430:~/development/public/opendata/other$ ruby essaie.rb
/home/user/.rvm/gems/ruby-2.1.0/gems/csv2json-0.2.0/lib/csv2json.rb:17:in `initialize': wrong number of arguments (2 for 0) (ArgumentError)
from /home/user/.rvm/gems/ruby-2.1.0/gems/csv2json-0.2.0/lib/csv2json.rb:17:in `new'
from /home/user/.rvm/gems/ruby-2.1.0/gems/csv2json-0.2.0/lib/csv2json.rb:17:in `parse'
from essaie.rb:5:in `block (2 levels) in <main>'
from essaie.rb:4:in `open'
from essaie.rb:4:in `block in <main>'
from essaie.rb:3:in `open'
from essaie.rb:3:in `<main>'
any help?
notes : file name essaie.csv contains the same data as input.csv (from the example of the documentation)
Just ran into this myself. Looks like they just forgot a dependency. Gems come with a list of other gems they require, but this developer probably had the orderedhash gem installed already and didn't pay attention to the need for it to be part of the dependency list for csv2json.
I typed:
gem install orderedhash
And then csv2json worked just fine for me.
See also a github issue recently opened about this:
https://github.com/darwin/csv2json/issues/12
Related
I'm using Ruby on Rails, and I installed all the necessary applications and updates for gems. I already exhausted/researched most of all possible answer for this error and tried all of it, but still am having no luck.
/Users/u=Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-3.2.13/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
/Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:76:in `require': cannot load such file -- false (LoadError)
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:72:in `each'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:72:in `block in require'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in `each'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in `require'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler.rb:134:in `require'
from /Users/Username/Downloads/job4quote/config/application.rb:7:in `'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in '
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /Users/Username/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `'
from script/rails:6:in `require'
from script/rails:6:in `'
Is there a way to access these .rb files to make necessary changes?
As shown here -> warning: circular argument reference
The problem seems to be caused by the higher version of ruby (In my case rails 3.2.13 and ruby 2.2) and using an older version of rails. One solution in which worked for me was to use ruby 2.0 and to update my gem file (RVM Capistrano).
gem 'rvm-capistrano', require: false
run the bundle install command. After that everything worked as expected.
silly of me, you can access the file by browsing it thru terminal
$ open .rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-3.2.13/lib/active_support/values
and made changes on that file as shown on the link about.
Sorry new with ruby.
I cloned a GitHub directory because I wanted to help on an open-source project.
The link to the project is listed below, so feel free to try it out for yourself.
https://github.com/tupini07/RubyMan
According to the README, I did the following
git clone https://github.com/tupini07/RubyMan
cd projects/RubyMan
ruby main.rb
Edit
I solved the first issue by running gem install win32console, but I still run into the same problem.
Error Message
C:\Users\darkmouse\Documents\Projects\RubyMan>ruby main.rb
C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in
`require': cannot load such file -- 2.0/Console_ext (LoadError)
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/Win32/Console.rb:12:in `rescue in <top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/Win32/Console.rb:8:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/Win32/Console/ANSI.rb:13:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32console-1.3.2-x86-mingw32/
lib/win32console.rb:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from C:/Users/darkmouse/Documents/Projects/RubyMan/Board.rb:2:in `<top (required)>'
from main.rb:4:in `require_relative'
from main.rb:4:in `<main>'
Main.rb
3 require_relative 'player'
4 require_relative 'Board'
5 require_relative 'LoadLevel'
Board.rb
2 require 'win32console'
The issues are listed above.
I run a Windows 8 Operating System.
I'd prefer not to bombard the repository with issues, so I decided to ask here.
I forked this same GitHub project, RubyMan, and cloned it on Ubuntu 14.04 LTS. I installed the current stable release of Ruby 2.2.2. I ran into almost the same problem as above when I changed to the RubyMan folder and ran:
ruby Main.rb
Here is the stack trace:
/usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- colorize (LoadError)
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/ashok/RubyMan/Board.rb:1:in `<top (required)>'
from Main.rb:3:in `require_relative'
from Main.rb:3:in `block in <main>'
from Main.rb:3:in `each'
from Main.rb:3:in `<main>'
Others who ran into a similar problem suggested on GitHub to:
sudo gem install colorize
Result:
Successfully installed colorize-0.7.7
Unfortunately, the above problem didn't go away :( I tried many other suggestions. No luck.
However, these two steps resolved the problem:
Step 1:
sudo gem update --system
Result:
RubyGems system software updated
I understand that this updates all installed gems to their latest versions.
Step 2:
sudo gem install colorize
Result:
Successfully installed colorize-0.7.7
Now I am able to launch the RubyMan program by running:
ruby Main.rb
Result:
What size will the board be?
And when I enter a number, it displays the 2D RubyMan game ready to play!
I'm just starting Test First Ruby & I'm having trouble running rakes to start solving problems.
I think it's either my version of RSpec or my version of Ruby that's causing the error.
Here's the error,
AT MacBook-Pro:01_temperature AT$ rake
(in /Users/AT/Desktop/learn_ruby)
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- temperature (LoadError)
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/AT/Desktop/learn_ruby/01_temperature/temperature_spec.rb:18:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `load'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `block in load_spec_files'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `each'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `load_spec_files'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:96:in `setup'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:84:in `run'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:69:in `run'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:37:in `invoke'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/exe/rspec:4:in `<top (required)>'
from /usr/bin/rspec:23:in `load'
from /usr/bin/rspec:23:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -S rspec /Users/AT/Desktop/learn_ruby/01_temperature/temperature_spec.rb -I/Users/AT/Desktop/learn_ruby/01_temperature -I/Users/AT/Desktop/learn_ruby/01_temperature/solution -f documentation -r ./rspec_config failed
I had a similar problem a few minutes ago but fixed by uninstalling RSpec v-3, and installing v-2.14.
Any help would be appreciated!
Your file temperature_spec is requiring what I presume is the source for the class under test, temperature - but the RSpec loader is not able to resolve the path for this file.
It would be helpful for you to post both the source of your rspec file and your class under test.
I have installed ruby 2.1.1 using rvm after root login. In another user login ruby 1.8.7 is in use. with 1.8.7 Redmine 2.5.0 works fine. but with 2.1.0
command:
ruby script/rails server webrick -d -e production
error:
/usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:252:in `require': /usr/local/rvm/gems/ruby-2.1.1/gems/vpim-0.695/lib/vpim/vcard.rb:679: invalid multibyte escape: /^\xFE\xFF/ (SyntaxError)
invalid multibyte escape: /^\xFF\xFE/
from /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:252:in `block in require'
from /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:237:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:252:in `require'
from /usr/local/rvm/gems/ruby-2.1.1/gems/vpim-0.695/lib/vpim.rb:12:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
from /home/dax/redmine-2.5.0/config/application.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-3.2.17/lib/rails/commands.rb:53:in `require'
from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-3.2.17/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-3.2.17/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-3.2.17/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Try to remove the gem vpim with this command:
gem uninstall vpim
I've tried an installation and don't need this gem.
If you really need that gem edit the file
/usr/local/rvm/gems/ruby-2.1.1/gems/vpim-0.695/lib/vpim/vcard.rb
and place this in the first line:
# encoding: US-ASCII
The vpim gem mentioned in your stack trace is not a requirement of core Redmine. It seems you have a custom plugin which requires that gem and which is not compatible with newer Ruby versions (i.e. anything >= 1.9).
To solve this issue, you thus need to update or remove that custom plugin. Also, right now, it is probably a good idea to not use Ruby 2.1 but Ruby 2.0 as it seems that Redmine core (or more generally, Rails 3.2) still has other issues with Ruby 2.1.1.
I am simply requiring a file present in the same folder as the testfile however I am getting this wierd message again and again...
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- a.rb (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/dummyFirefox/test_a.rb:1:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `block in load_spec_files'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `map'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in `run'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `block in autorun'
the code that I write in my testfile test_a.rb is simply:
require 'a.rb'
and when I issue the command : rspec test_a.rb the message is the above mentioned error.
I am using ruby-1.9.2 for development.
Hope I don't miss any details.
Thanks in advance.
In Ruby 1.9.2 the current working directory is no longer part of the load path ($LOAD_PATH or $:). You have to add it manually using:
$LOAD_PATH.unshift '.'
or
$:.unshift '.'
Or you can require the file explicitly:
require './test_a.rb'