Forum: Ruby ruby error messages

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Cb33b32bd5d675db7be148542976e510?d=identicon&s=25 sam (Guest)
on 2005-11-24 09:02
(Received via mailing list)
Hi there,

Is the meaning of the ruby error messages defined anywhere? E.g. I get
something like:

NameError: uninitialized constant Blah

and maybe you'll tell me it's self explanatory, but it would be nice to
look through a list of errors and read more about what they mean. I
searched the web and asked on ruby-lang irc channel but haven't turned
up anything yet.

Many thanks in advance.

5befe95e6648daec3dd5728cd36602d0?d=identicon&s=25 (Guest)
on 2005-11-24 09:54
(Received via mailing list)
Sam Joseph wrote:
> up anything yet.
As far as I know there is no such comprehensive list (note, I may be
here).  But closely looking at the exception stack trace and the code it
points to you usually see what's wrong very fast.

Kind regards

22b74ae3adfc74ff5c7c0b0a94b78a48?d=identicon&s=25 kozlov.y (Guest)
on 2005-11-24 11:51
(Received via mailing list)
> NameError: uninitialized constant Blah

irb(main):002:0> x = My_case_is_wrong
NameError: uninitialized constant My_case_is_wrong
        from (irb):2

grep -r Blah  you_program_dir
is make clear the situation.
31af45939fec7e3c4ed8a798c0bd9b1a?d=identicon&s=25 M.B.Smillie (Guest)
on 2005-11-24 12:39
(Received via mailing list)
On Nov 24, 2005, at 8:01, Sam Joseph wrote:

> searched the web and asked on ruby-lang irc channel but haven't turned
> up anything yet.

Sounds like a decent wiki page.

What it means is that something Ruby considers a constant is being
used without being initialised, which I suppose is obvious.

The less-obvious bit is "something Ruby considers a constant" which
is "an identifier that starts with an uppercase letter".  All class
and module names, for instance.  (Forgive me if that's a little
amorphous - I don't have a language grammar to poke through for the
actual definition).

So, for this error, I would look for typos, particularly in
assignment statements (as one poster mentioned), but also in class
definitions - maybe you defined your class as "Balh" when you meant
"Blah".  For particularly tricky cases, you can get a list of
constants via 'Module.constants'.

matthew smillie.
Cb33b32bd5d675db7be148542976e510?d=identicon&s=25 sam (Guest)
on 2005-11-24 13:08
(Received via mailing list)
Thanks Robert and Yuri,

As a ruby newbie I'm finding that I'm getting a little stuck.  I've been
programming in Java/C like languages for about 15 years, so maybe I'm
just having trouble getting used to the brave new world, so perhaps
you'll bear with me while I take you through some details.

I really like ruby but I'm finding it hard to get to the bottom of
things when I do get errors.

My current situation involves a module called Gruff.  I've mailed my
problems to the gruff forums on rubyforge, and we're working on it
there, however I'd really like to be able to help solve the problem

I've downloaded gruff and rmagick using gems, and I'm trying a gruff
code sample in irb (I previously tried an rmagick sample and that

require 'rubygems'
require 'gruff'

g =

require 'rubygems' returns a fail, and require 'gruff' gives an error,
but I can get it to just return false if I comment out the relevant line
of code in the gruff source.

Anyhow, when I type g = I get the this error:

NameError: uninitialized constant Gruff

which I presume is telling me that we have failed to pull in the gruff
module - adjusting the capitalization is no help:

irb(main):004:0> g  =
NameError: undefined local variable or method `gruff' for
        from (irb):4

The thing is I'm stuck as to how to proceed from here - is there some
way for me to interogate the system so I can find out why the require
'gruff' is failing?

As I understand it my path is set up fine:

irb(main):005:0> $:
=> ["d:/ruby/lib/ruby/gems/1.8/gems/RMagick-win32-1.9.2-mswin32/bin",
bin", "d:/ruby/lib/ruby/gems/1.8/gems/gruff-0.0.6/lib",
"d:/ruby/lib/ruby/site_ruby", "d:/ruby/lib/r
uby/1.8", "d:/ruby/lib/ruby/1.8/i386-mswin32", "."]

i.e. i get all the above after entering the require commands, despite
the fact that they return failures.

hmm, so actually writing all this out helped - as I just fixed the
problem.  It seems that I needed to restart irb each time I made
modifications to the source code in order to see the continuing errors
being generated after my modifications.

I was confused beacause after throwing an error once, a repeat call to
require would just return false, without any error message.  By
restarting irb and seeing the addtional errors, I commented out a load
of undef_method calls in rmagick.rb and now it all works.

Sometimes you just need to be able to explain these things to someone

Many thanks for your input


Robert Klemme wrote:

>As far as I know there is no such comprehensive list (note, I may be wrong
>here).  But closely looking at the exception stack trace and the code it
>points to you usually see what's wrong very fast.
C1530215e591aa5db62d493a67585562?d=identicon&s=25 Pavel Sokolov (elgato)
on 2005-11-24 13:41
Find Gruff lib. There is a base.rb file.

1. begin
2.  require 'rmagick'
3. rescue LoadError
4.  require 'RMagick' # capitalized on Windows
5. end

comment out lines 1-3 and 5. Gruff does not deal good with "requre" on

Hope this helps you.

This topic is locked and can not be replied to.