[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Newbie question 'require'

Serg Koren

1/29/2008 11:46:00 PM

Hi I've installed the sqlite3-ruby gem via gem install. However =20
when I do a:

require 'sqlite3'

I get a LoadError: no such file to load =97 sqlite3. This is on Mac =20=

OSX 10.5.2. Yes I have slite3 installed and working. I checked the =20=

gems directory and the sqlite3.rb file exists. I'm obviously missing =20=

something obvious.

Any pointers would be appreciated.

S


5 Answers

Thomas Wieczorek

1/29/2008 11:53:00 PM

0

On Jan 30, 2008 12:45 AM, Serg Koren <skoren@comcast.net> wrote:
>
> I get a LoadError: no such file to load =97 sqlite3. This is on Mac
> OSX 10.5.2. Yes I have slite3 installed and working. I checked the
> gems directory and the sqlite3.rb file exists. I'm obviously missing
> something obvious.
>

Try adding
require 'rubygems'

Serg Koren

1/30/2008 12:03:00 AM

0

That did it!
Thanks much...told you it was a newbie question ;-)
S

On Jan 29, 2008, at 6:52 PM, Thomas Wieczorek wrote:

> On Jan 30, 2008 12:45 AM, Serg Koren <skoren@comcast.net> wrote:
>>
>> I get a LoadError: no such file to load =97 sqlite3. This is on =
Mac
>> OSX 10.5.2. Yes I have slite3 installed and working. I checked the
>> gems directory and the sqlite3.rb file exists. I'm obviously missing
>> something obvious.
>>
>
> Try adding
> require 'rubygems'
>


Thomas Wieczorek

1/30/2008 12:26:00 AM

0

On Jan 30, 2008 1:02 AM, Serg Koren <skoren@comcast.net> wrote:
> That did it!
> Thanks much...told you it was a newbie question ;-)
>

You're welcome! I had the problem a few month ago, when I installed
Ruby on Windows without admin rights. Had to include that, because the
RUBYOPT enviroment variable didn't exist. Write -rubygems in it and
you don't have to require them every time.

Have fun with Ruby!

Tim Hunter

1/30/2008 12:41:00 AM

0

Serg Koren wrote:
> Hi I've installed the sqlite3-ruby gem via gem install. However when
> I do a:
>
> require 'sqlite3'
>
> I get a LoadError: no such file to load ? sqlite3. This is on Mac OSX
> 10.5.2. Yes I have slite3 installed and working. I checked the gems
> directory and the sqlite3.rb file exists. I'm obviously missing
> something obvious.
>
> Any pointers would be appreciated.
>
> S
>
>

When you install a gem you must use RubyGems to load it as well. Did you
enable RubyGems in your pgm before reequiring sqlite3? The simplest
(tho' least robust) way is to add

require 'rubygems'

at the top of your program.
--
RMagick: http://rmagick.ruby...
RMagick 2: http://rmagick.ruby...rmagick2.html

Markus Arike

1/30/2008 1:27:00 AM

0

Tim Hunter wrote:
> Serg Koren wrote:
>> Any pointers would be appreciated.
>>
>> S
>>
>>
>
> When you install a gem you must use RubyGems to load it as well. Did you
> enable RubyGems in your pgm before reequiring sqlite3? The simplest
> (tho' least robust) way is to add
>
> require 'rubygems'
>
> at the top of your program.

You could also add,

export RUBYOPT=rubygems

to your .profile file. This is the solution I use as I avoid having to
type require 'rubygems'

on every script that has a gem lib file as a dependency.

If you don't know how to set environment variables in BASH, google would
be a good start.
--
Posted via http://www.ruby-....