Turn off warnings in ruby

Discussion in 'Ruby' started by Jim Burgess, Jan 8, 2009.

  1. Jim Burgess

    Jim Burgess Guest

    Hi,

    I am writing a ruby application with FXRuby, which also uses the ruby
    gem 'spreadsheet' to create an Excel file. Everything was working fine
    until this morning when, for some reason, when I ran my application, it
    started spewing out warnings at me (literally hundreds), caused by the
    'spreadsheet' gem.
    e.g.
    "c:/ruby/lib/ruby/gems/1.8/gems/spreadsheet-0.6.1.9/lib/spreadsheet/datatypes.rb:27:
    warning: instance variable @text_wrap not initialized"

    Can anyone tell me how to turn off warnings in ruby while I try to
    figure this out?

    Thanks a lot.
    I'm currently working with ruby 1.8.6 and using xp
    --
    Posted via http://www.ruby-forum.com/.
    Jim Burgess, Jan 8, 2009
    #1
    1. Advertising

  2. Jim Burgess wrote:
    > Hi,
    >
    > I am writing a ruby application with FXRuby, which also uses the ruby
    > gem 'spreadsheet' to create an Excel file. Everything was working fine
    > until this morning when, for some reason, when I ran my application, it
    > started spewing out warnings at me (literally hundreds), caused by the
    > 'spreadsheet' gem.
    > e.g.
    > "c:/ruby/lib/ruby/gems/1.8/gems/spreadsheet-0.6.1.9/lib/spreadsheet/datatypes.rb:27:
    > warning: instance variable @text_wrap not initialized"
    >
    > Can anyone tell me how to turn off warnings in ruby while I try to
    > figure this out?


    It's probably harmless, so don't panic. You can report that to Hannes on
    the project page as a bug:

    http://www.rubyforge.org/projects/spreadsheet

    > Thanks a lot.
    > I'm currently working with ruby 1.8.6 and using xp


    I'm curious what turned warnings on, since they're not on by default.
    What happens if you run ruby with -W0?

    Regards,

    Dan
    Daniel Berger, Jan 9, 2009
    #2
    1. Advertising

  3. Jim Burgess

    Jim Burgess Guest

    Hi,

    Thanks for the advice.
    Running the script from the command line thus, "ruby -W0 invoices.rb"
    still produces hundreds of warnings.
    Is that then the correct way to turn warnings off? If so, it doesn't
    seem to work :)
    Do you think I should report this problem?
    I already tried installing (and uninstalling) various versions of the
    spreadsheet gem. I also tried downgrading to earlier versions of ruby,
    but the result was always the same.
    What I will do also is set this up in Linux and try and reproduce the
    error ther. Maybe it's windows specific?
    Would be grateful for any advice


    --
    Posted via http://www.ruby-forum.com/.
    Jim Burgess, Jan 9, 2009
    #3
  4. Jim Burgess

    Marc Heiler Guest

    > Is that then the correct way to turn warnings off?

    I dont know how others do it but I fix all the warnings ruby spits out
    in my scripts, which sometimes is only annoying if I include stuff from
    other authors who do not fix those kind of warnings.

    I think there should exist a standard that at least mandates that all
    the more popular gems etc... stuff that is used in ruby, should produce
    no warnings.

    This is just a nuisance IMHO and people should freely use -w flags all
    the time.
    --
    Posted via http://www.ruby-forum.com/.
    Marc Heiler, Jan 9, 2009
    #4
  5. Jim Burgess

    Jim Burgess Guest

    I solved the problem :)
    I was using the latest version of FXRuby (1.6.16)
    I uninstalled this and dropped back to the previous version.
    Now when I run the programs everything works as it should.
    I guess I should have thought of this sooner.
    Thanks for the help.

    --
    Posted via http://www.ruby-forum.com/.
    Jim Burgess, Jan 9, 2009
    #5
  6. Jim Burgess wrote:
    > I solved the problem :)
    > I was using the latest version of FXRuby (1.6.16)
    > I uninstalled this and dropped back to the previous version.
    > Now when I run the programs everything works as it should.
    > I guess I should have thought of this sooner.
    > Thanks for the help.


    You could get rid of those warning messages this way:
    $VERBOSE = nil

    -r.
    --
    Posted via http://www.ruby-forum.com/.
    Rodrigo Bermejo, Jan 9, 2009
    #6
  7. Jim Burgess

    Jim Burgess Guest

    Hi,

    > You could get rid of those warning messages this way:
    > $VERBOSE = nil


    I tried that and couldn't get it to work.
    Where exactly in my code should I insert that?
    Will this then kill all warnings for my program, including those
    generated by a third party library?




    --
    Posted via http://www.ruby-forum.com/.
    Jim Burgess, Jan 10, 2009
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer
    Replies:
    2
    Views:
    449
    Cheung, Jeffrey Jing-Yen
    Jul 8, 2003
  2. robert112
    Replies:
    1
    Views:
    437
    Juan T. Llibre
    Apr 26, 2007
  3. mikshir
    Replies:
    6
    Views:
    143
    mikshir
    Dec 16, 2005
  4. Keith Fahlgren
    Replies:
    3
    Views:
    152
  5. Ted Sung
    Replies:
    1
    Views:
    307
    Sherm Pendley
    Aug 30, 2004
Loading...

Share This Page