当前位置 : 主页 > 网络编程 > 其它编程 >

cvs2json无法加载此类文件-orderedhash-cvs2jsoncannotloadsuchfile—orderedhash

来源:互联网 收集:自由互联 发布时间:2023-07-02
Imtryingtousethisgem:csv2json(0.3.0)andImgettinganerror.我正在尝试使用这个gem:csv2json(0.3.0), I'm trying to use this gem: csv2json (0.3.0) and I'm getting an error. 我正在尝试使用这个gem:csv2json(0.3.0),我收到一个错误
Imtryingtousethisgem:csv2json(0.3.0)andImgettinganerror.我正在尝试使用这个gem:csv2json(0.3.0),

I'm trying to use this gem: csv2json (0.3.0) and I'm getting an error.

我正在尝试使用这个gem:csv2json(0.3.0),我收到一个错误。

On my file essaie.rb:

在我的档案essaie.rb:

require 'csv2json'File.open('essaie.csv', 'r') do |input| File.open('output.json', 'w') do |output| CSV2JSON.parse(input, output) endenduser@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 `' 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 `'

When I remove the version 0.3.0(csv2json) and I installed the previous version I'm getting this error:

当我删除版本0.3.0(csv2json)并且我安装了以前的版本时,我收到此错误:

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 ' from essaie.rb:4:in `open' from essaie.rb:4:in `block in ' from essaie.rb:3:in `open' from essaie.rb:3:in `'

any help?

notes : file name essaie.csv contains the same data as input.csv (from the example of the documentation)

注意:文件名essaie.csv包含与input.csv相同的数据(来自文档示例)

1 个解决方案

#1

10

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.

刚碰到这个。看起来他们只是忘了依赖。 Gems附带了他们需要的其他gem的列表,但是这个开发人员可能已经安装了orderedhash gem,并且没有注意它是否需要成为csv2json的依赖列表的一部分。

I typed:

gem install orderedhash

gem install orderedhash

And then csv2json worked just fine for me.

然后csv2json对我来说工作得很好。

See also a github issue recently opened about this:

另见最近关于此的github问题:

https://github.com/darwin/csv2json/issues/12

【文章转自:日本站群服务器 http://www.558idc.com/japzq.html处的文章,转载请说明出处】
上一篇:DOM自学中的一个问题,求解答,谢谢
下一篇:没有了
网友评论