Please forgive the double posting, I just thought it would be better to
list this issue separately, with a more communicative subject (please
reply to this one).
I’ve just started learning Ruby (and Geo Ruby), and am trying to create
overlays for Google Maps.
Have everything installed properly (as far as I
can tell - gem list gives me the whole bundle including: mysql (2.8.1)).
MySQL working fine.
I get this error when trying to run the script (attached) from a shell:
Command:
$ ruby ./Desktop/gen_encpolygons.rb
Returns:
./Desktop/gen_encpolygons.rb:11:in initialize': wrong number of arguments (4 for 0) (ArgumentError) from ./Desktop/gen_encpolygons.rb:11:in new’
from ./Desktop/gen_encpolygons.rb:11:in `generate_js_border_overlay’
from ./Desktop/gen_encpolygons.rb:95
I’ve googled extensively for similar argument errors, and I’m not
finding any good matches (or solutions).
I don’t think this is a script problem, but everything seems to check
out with the MySQL, and the other gems.
If a simple Mysql.new fails, I’d be real tempted to delete that gem and
reinstall. Have you possibly done an OS upgrade since you originally
installed it? Or switched to rvm?
I get this:
checking – Class
./Desktop/test.rb:5:in initialize': wrong number of arguments (4 for 0) (ArgumentError) from ./Desktop/test.rb:5:in new’
from ./Desktop/test.rb:5
I don’t think this is a script problem, but everything seems to check
out with the MySQL, and the other gems.
You don’t happen to have a file called “mysql.rb” in your working
directory do you?
I made that mistake before - for example, writing a test program for
sinatra and deciding to call it ‘sinatra.rb’
Hi Brian,
Thanks for the response.
No, I only have the ruby gem ‘mysql.rb’ with that name.
I don’t think this is a script problem, but everything seems to check
out with the MySQL, and the other gems.
If a simple Mysql.new fails, I’d be real tempted to delete that gem and
reinstall. Have you possibly done an OS upgrade since you originally
installed it? Or switched to rvm?
Hi Hassan,
Thanks for bearing with me on this.
No OS upgrade, haven’t switched, not using the version manager (should I
be?).
I changed line 11 to borderDB = Mysql.real_connect(‘localhost’, ‘root’,
‘root’, ‘my_database’)
and now I get the following error:
./Desktop/gen_encpolygons.rb:11:in generate_js_border_overlay': undefined methodreal_connect’ for Mysql:Class (NoMethodError)
from ./Desktop/gen_encpolygons.rb:95
Yes, mysql.new failed.
So, I think I am going to uninstall the gem, and reinstall it. Would it
be better to use the ‘pure ruby’ gem? What would you guys recommend?
No OS upgrade, haven’t switched, not using the version manager (should I
be?).
It’s useful, but I wouldn’t necessarily start until you figure this out.
So, I think I am going to uninstall the gem, and reinstall it. Would it
be better to use the ‘pure ruby’ gem?
I would just go with a complete reinstall of the standard gem (with the
native extensions) and see what happens. Document the entire – i.e.
both removal and re-installation – process just in case
Non-ruby-related tip: use the script command to capture all of the
relevant console input and output, e.g.
I get this:
checking – Class
./Desktop/test.rb:5:in initialize': wrong number of arguments (4 for 0) (ArgumentError) from ./Desktop/test.rb:5:innew’
from ./Desktop/test.rb:5
I don’t think this is a script problem, but everything seems to check
out with the MySQL, and the other gems.
You don’t happen to have a file called “mysql.rb” in your working
directory do you?
I made that mistake before - for example, writing a test program for
sinatra and deciding to call it ‘sinatra.rb’
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.