Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby cannot load such file --ftools (Load Error)

Tags:

ruby

I'm a complete Ruby newbie and all I want to do is just run a legacy ruby script (that too an open source one by Erik Veenstra). I have a Windows batch script that runs it basically that I am trying to execute. I installed Ruby on my computer, allowed it to set paths, and I tried to run it and here's the error I got:

I:/2011/devl/3rdparty/ruby/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- ftools (LoadError)
        from I:/2011/devl/3rdparty/ruby/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/Users/<blah>/AppData/Local/Temp/tar2rubyscript.d.6692.1/rubyscript2exe/ev/ftools.rb:1:in `<top (required)>'
        from I:/2011/devl/3rdparty/ruby/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from I:/2011/devl/3rdparty/ruby/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/Users/<blah>/AppData/Local/Temp/tar2rubyscript.d.6692.1/rubyscript2exe/init.rb:15:in `<top (required)>'
        from I:/2011/devl/path/to/<myrbsrc>/trunk/bin/../src/rubyscript2exe.rb:627:in `load'
        from I:/2011/devl/path/to/<myrbsrc>/trunk/bin/../src/rubyscript2exe.rb:627:in `block in <main>'
        from I:/2011/devl/path/to/<myrbsrc>/trunk/bin/../src/rubyscript2exe.rb:577:in `block in newlocation'
        from I:/2011/devl/path/to/<myrbsrc>/trunk/bin/../src/rubyscript2exe.rb:505:in `block in newlocation'
        from I:/2011/devl/path/to/<myrbsrc>/trunk/bin/../src/rubyscript2exe.rb:472:in `newlocation'
        from I:/2011/devl/path/to/<myrbsrc>/trunk/bin/../src/rubyscript2exe.rb:505:in `newlocation'
        from I:/2011/path/to/<myrbsrc>/trunk/bin/../src/rubyscript2exe.rb:577:in `newlocation'
        from I:/2011/devl/path/to/<myrbsrc>/trunk/bin/../src/rubyscript2exe.rb:619:in `<main>'

Appreciate any ideas on how to resolve this! If it helps I can post the source Ruby code.

like image 975
squashed.bugaboo Avatar asked Jul 19 '12 00:07

squashed.bugaboo


2 Answers

use

require "fileutils"

instead because ftools is not supported with ruby-1.9.x

like image 180
Neeraj Kumar Avatar answered Sep 27 '22 21:09

Neeraj Kumar


Apparently, the source code I had is a lot older and even after getting the latest version, it had issues. But knowing that it worked at some point, I proceeded to install an older version of Ruby on Windows (1.8.7-p358) and everything works fine then and I was able to build and get my executable. Anyway, not the most elegant solution. But if anybody knows of a fix for rubyscript2exe with the latest Windows version of Ruby, please reply. Thanks.

like image 21
squashed.bugaboo Avatar answered Sep 27 '22 22:09

squashed.bugaboo