Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Script throws error whenever I require mysql gem

Reply
Thread Tools

Script throws error whenever I require mysql gem

 
 
Chris Gallagher
Guest
Posts: n/a
 
      03-24-2009
Hi all,

Ive been working on a small script and Im about to place some
functionality into it which allows it to write to my database by making
use of activerecord. I'm hitting a brick wall at the moment so I've come
to you for your expertise

The script runs perfectly fine until i...

require 'mysql'

..even though I havent actually asked the script to do anything more
than connect to mysql. if i comment out the configure block the error
still occurs.

I thought mysql was the issue so i completely reinstalled it from source
and the same error still occurs.

heres the error im seeing on Mac OS X Tiger:

/usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1/mysql.bundle: Failed
to lookup Init function
/usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1/mysql.bundle
(LoadError)
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in
`new_constants_in'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in
`require'
from bot.rb:6
/usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1/mysql.bundle: Failed
to lookup Init function
/usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1/mysql.bundle
(LoadError)
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in
`new_constants_in'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in
`require'
from bot.rb:6
/usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1/mysql.bundle: Failed
to lookup Init function
/usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1/mysql.bundle
(LoadError)
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in
`new_constants_in'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in
`require'
from bot.rb:6
cgallagher:~/work/tuneme/bot chrisgallagher$



The script for anyone interested is simply as follows:

require 'rubygems'
require 'sinatra'
require 'scrobbler'
require 'twibot'
require 'activerecord'
require 'mysql'

#startup tasks
configure do
#connect to database
ActiveRecord::Base.establish_connection({
:adapter => "mysql",
:database => "tuneme",
:socket => "/tmp/mysql.socket",
:username => "root",
assword => ""
})
end

class Link < ActiveRecord::Base
end


reply do |message, params|


#create entry test
# link = Link.create(:LinkValue => '123xyz')


#check last.fm for a recomendation
message_content = message.text
artist_name = message_content.gsub("@tuneme ", "")
p artist_name
artist = Scrobbler::Artist.new(artist_name)
#artist.similar.each { |a| puts "(#{a.match}%) #{a.name}" }
similar_artist = artist.similar.first.name
message = "@" + message.user.screen_name + " #{similar_artist} and
others... "
post_tweet message
end




I'm completely at a loss here... any ideas?

Cheers
Chris
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
lasitha
Guest
Posts: n/a
 
      03-24-2009
On Tue, Mar 24, 2009 at 6:36 AM, Chris Gallagher <> wrote:
> [...]
>
> The script runs perfectly fine until i...
>
> require 'mysql'
>
> [...]
>
> /usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1/mysql.bundle: Failed
> to lookup Init function


The following post is probably still relevant:
http://rubyurl.com/B4Kl

cheers,
lasitha.

 
Reply With Quote
 
 
 
 
Chris Gallagher
Guest
Posts: n/a
 
      03-25-2009
OK, I've now done a complete uninstall and reinstalled with macports
instead. Now I'm seeing the following error:

LoadError: Failed to lookup Init function
/usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.9.1/mysql.bundle
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
feezing mysql gem + unitiliazed constant MysqlCompat::Mysql Renato Jf Ruby 3 12-15-2009 12:13 AM
Problems with 'gem require' and test-unit gem Daniel Berger Ruby 2 09-12-2008 07:15 PM
mySQL Ruby Gem and MAMP mySQL Mark Meijer Ruby 3 02-03-2008 04:19 AM
RubyGems 0.9.1 calling a gem with gem '<gem>' Austin 7873 Ruby 5 01-27-2007 10:05 PM
gem query finds gem, yet require fails Michael Glaesemann Ruby 5 11-26-2006 02:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57