Exception 'LoadError' everywhere

S

Samuel Slayden

Hi folks,

I am a total Ruby noob, so please forgive my ignorance.

Background - A previous co-worker wrote some handy Ruby scripts to
process some spreadsheets. Ruby environment (Windows) was loaded on his
computer and all ran well. Co-worker leaves, and his computer is sent to
be refreshed. The environment is lost, but his Ruby scripts were saved
on the network.

Now - I have attempted to install Ruby and the necessary gems to allow
these nifty scripts to live once again. Unfortunately, I have been
getting several errors when I run in debug (ruby -d). The main error I
am getting is:

MergeRead.rb:40: warning: shadowing outer local variable - row
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no
such file to load -- rubygems/defaults/ruby

Version I am running is:
C:\Users\sla8sr\Documents\Testing\Ruby>ruby -v
ruby 1.9.2p136 (2010-12-25) [i386-mingw32]

C:\Users\sla8sr\Documents\Testing\Ruby>gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-12-25 patchlevel 136) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby192/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: C:/Ruby192/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby192/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby192/lib/ruby/gems/1.9.1
- C:/Users/sla8sr/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/

C:\Users\sla8sr\Documents\Testing\Ruby>gem list

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.3)
actionpack (3.0.3)
activemodel (3.0.3)
activerecord (3.0.3)
activeresource (3.0.3)
activesupport (3.0.3)
arel (2.0.6)
builder (2.1.2)
bundler (1.0.7)
erubis (2.6.6)
fastercsv (1.5.3)
i18n (0.5.0)
mail (2.2.14)
mime-types (1.16)
minitest (1.6.0)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.7)
rails (3.0.3)
railties (3.0.3)
rake (0.8.7)
rdoc (2.5.8)
roo (1.9.3)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.23)

Can someone please take a look and give me a little direction? I have
attached the complete debug file as well as the .rb that produced it.

Thank You and Best Regards,
Sam

Attachments:
http://www.ruby-forum.com/attachment/5676/MergeRead.rb
http://www.ruby-forum.com/attachment/5677/RubyDebug.txt
 
P

Phillip Gawlowski

Hi folks,

I am a total Ruby noob, so please forgive my ignorance.

No worries. :)
Background - A previous co-worker wrote some handy Ruby scripts to
process some spreadsheets. Ruby environment (Windows) was loaded on his
computer and all ran well. Co-worker leaves, and his computer is sent to
be refreshed. The environment is lost, but his Ruby scripts were saved
on the network.

Now - I have attempted to install Ruby and the necessary gems to allow
these nifty scripts to live once again. Unfortunately, I have been
getting several errors when I run in debug (ruby -d). The main error I
am getting is:

The problem is that the environment used doesn't exist anymore. Has
said coworker, maybe, left notes somewhere about his script?
Particularly the versions of Ruby, Roo, and FasterCSV used?

However, a little post-mortem:
MergeRead.rb:40: warning: shadowing outer local variable - row
This is an error telling you that a block variable is already used as
a local variable. This is a hint that your coworker used a version of
Ruby that wasn't 1.9 (so, 1.8.X, most likely), and can, in your
script, be fixed by changing the block variable |row| (for example),
to something else. Keep in mind that every instance of row has to be
replaced. :)
Exception `LoadError' at <internal:lib/rubygems/custom_require>:29 - no
such file to load -- rubygems/defaults/ruby

Ruby 1.9 included RubyGems as part of its standard library, and I
guess that the require "rubygems" throws this error.
Can someone please take a look and give me a little direction? I have
attached the complete debug file as well as the .rb that produced it.

Looking at the script:
Ruby's CSV has been replaced with FasterCSV, and requiring RubyGems
isn't necessary anymore.

First, I'd try and see if removing the require "rubygems" and require
"fastercsv" already fix the script. You might have to replace require
"fastercsv" with just require "csv", though.

If you don't want to rewrite the script, you could try installing Ruby
1.8.x (probably 1.8.6 was used), and see if installing RubyGems,
FasterCSV, and Roo are enough to make the script run again.

Rewriting can be done with Ruby's win32ole[0] support (The Ruby on
Windows blog has a few articles related to just that[1]), and CSV.
That could be done faster than trying to rebuild an environment by
trial and error, I think.

HTH!

[0] http://ruby-doc.org/stdlib/libdoc/win32ole/rdoc/index.html
[1] http://rubyonwindows.blogspot.com/search/label/excel
--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top