Closed docwhat closed 11 years ago
Hi docwhat,
I've released a pre version of irbtools 1.1.0 which outputs more helpful error messages. Can you please test it again with that version?
$ gem install irbtools
âââ info âââââââââââââââââââââââââââââââ
J-_-L â https://github.com/janlelis/irbtools â
âââ usage ââââââââââââââââââââââââââââââ¤
â require 'irbtools' â
ââââââââââââââââââââââââââââââââââââââââ
Successfully installed irbtools-1.0.6
1 gem installed
$ irb
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
>> exit
Couldn't load an irb library: exception class/object expected
Couldn't load an irb library: exception class/object expected
$
Yes, I get the weird 'a' characters.....
Sry, I meant the pre version. You can install it with gem install irbtools --pre
$ gem install irbtools --pre
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: irbtools requires every_day_irb (>= 1.1.0.pre)
$ gem install every_day_irb --pre
ERROR: Could not find a valid gem 'every_day_irb' (>= 0) in any repository
ERROR: Possible alternatives: every_day_irb
sry... i should automate that again, fixe that... ;)
Ah, here we go...much better message:
$ gem install irbtools --pre
Fetching: coderay-1.0.0.gem (100%)
Fetching: method_locator-0.0.4.gem (100%)
Fetching: looksee-1.0.3.gem (100%)
Building native extensions. This could take a while...
Fetching: every_day_irb-1.1.0.pre.gem (100%)
Fetching: irbtools-1.1.0.pre.gem (100%)
┌── info ──────────────────────────────┐
J-_-L │ https://github.com/janlelis/irbtools │
├── usage ─────────────────────────────┤
│ require 'irbtools' │
└──────────────────────────────────────┘
Successfully installed coderay-1.0.0
Successfully installed method_locator-0.0.4
Successfully installed looksee-1.0.3
Successfully installed every_day_irb-1.1.0.pre
Successfully installed irbtools-1.1.0.pre
5 gems installed
$ irb
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
>> exit
Couldn't load the irb library 'hirb': TypeError
* exception class/object expected
* /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
Hi docwhat,
cannot reproduce that error. Can you please try to deactivate some of your IRB options (the error is probably history-related)? Can you also try, to only load hirb and check, if it throws the error?
Thanks
Okay, so I decided to get more methodical....
https://github.com/docwhat/irbtools-debugging
0 is a straight forward run.
1 does a require "hirb"
then exit
2 does a require "hirb"
, require 'boson'
then exit
I've saved off the .irbrc
and .irb-history
in each directory so you can look at it.
I re-did tests using a Gemfile and gemset to make sure other gems weren't interfering.
It looks like boson isn't being pulled in correctly? I'm rather confused.
Hey docwhat. Thanks for your debugging tests. Can you please also try the following things:
irb -f
) and see if it throws errorscan you please edit line 33 in irbtools.rb to show the whole backtrace (e.g. with the gemedit
gem) and post it!
... + err.backtrace[0] + ...
-->
... + err.backtrace.join("\n") + ...
(this is using the Gemfile from the irbtools-debugging
repo I posted above....)
I could not generate an error using irb -f
and require 'hirb'
and/or require 'boson'
.
Interestingly, if I use irb -f
and do require 'irbtools'
I get an error:
be irb -f
irb(main):001:0> require 'irbtools'
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
NoMethodError: undefined method `colorize_result' for Wirb:Module
from /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/fancy_irb-0.7.1/lib/fancy_irb.rb:44:in `block in start'
from /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/fancy_irb-0.7.1/lib/fancy_irb/irb_ext.rb:41:in `[]'
from /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/fancy_irb-0.7.1/lib/fancy_irb/irb_ext.rb:41:in `block in output_value'
from /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/fancy_irb-0.7.1/lib/fancy_irb/irb_ext.rb:39:in `each'
from /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/fancy_irb-0.7.1/lib/fancy_irb/irb_ext.rb:39:in `inject'
from /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/fancy_irb-0.7.1/lib/fancy_irb/irb_ext.rb:39:in `output_value'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:160:in `block (2 levels) in eval_input'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:273:in `signal_status'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:156:in `block in eval_input'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:70:in `block in start'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:69:in `catch'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb.rb:69:in `start'
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'Maybe IRB bug!!
Making the backtrace be more verbose, I get the results in 5-full-backtrace
...I copied the output here:
Couldn't load the irb library 'hirb': TypeError
* exception class/object expected
* /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/hirb-0.5.0/lib/hirb.rb:11:in `require'
/Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/hirb-0.5.0/lib/hirb.rb:11:in `<top (required)>'
/Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/irbtools-1.1.0.pre/lib/irbtools.rb:29:in `require'
/Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/irbtools-1.1.0.pre/lib/irbtools.rb:29:in `block (2 levels) in <top (required)>'
/Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/irbtools-1.1.0.pre/lib/irbtools.rb:27:in `each'
/Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/irbtools-1.1.0.pre/lib/irbtools.rb:27:in `block in <top (required)>'
/Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/irbtools-1.1.0.pre/lib/irbtools.rb:117:in `[]'
/Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/irbtools-1.1.0.pre/lib/irbtools.rb:117:in `block (2 levels) in <top (required)>'
Just for giggles and grins, I modified my .irbrc
to read:
require 'hirb'
require 'boson'
and it worked fine.
So I think it might be an ordering problem.
I've changed the loading order and uploaded it as irbtools-1.1.0.pre.2
. Can you please test it again :)?
It's still doing it. I updated it to that my debugging repo.
This stuff seems almost random, like something is shifting around on load. I wonder if it's actually a bug in ruby or irb?
I can run irb sometimes and I get no error. But most of the time I get the hirb
error and occasionally the boson
error.
might have been an error by me. can you please try the next pre-release :)?
$ be irb
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
>> exit
Couldn't load the irb library 'boson': TypeError
* exception class/object expected
* /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/irbtools-1.1.0.pre.2/lib/irbtools.rb:29:in `require'
$ be irb
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
>> puts "hi" #=> nil
hi
>> exit
Couldn't load the irb library 'boson': TypeError
* exception class/object expected
* /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/alias-0.2.2/lib/alias.rb:8:in `require'
This is awfully weird.
I should mention be
is an alias for bundle exec
....
Also, this:
be irb ──(git:master)─┘
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
>> require 'boson' #=> false
>> exit
(no error) I'm sooooo confused.
Sorry, those were the wrong versions....
This is with pre3....
$ be irb
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
>> exit
Couldn't load the irb library 'hirb': TypeError
* exception class/object expected
* /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/hirb-0.5.0/lib/hirb/views.rb:8:in `require'
$ be irb
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
>> exit
Couldn't load the irb library 'boson': TypeError
* exception class/object expected
* /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/boson-0.3.4/lib/boson.rb:1:in `require'
$ be irb
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
>> puts 'hi' #=> nil
hi
>> exit
Couldn't load the irb library 'boson': TypeError
* exception class/object expected
* /Users/docwhat/.rvm/gems/ruby-1.9.2-p290@irbtools-debug/gems/boson-0.3.4/lib/boson.rb:3:in `require'
$ be irb
Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
>> require 'boson' #=> true
>> exit
I commented out the two Thread.new
parts...leaving the load_libraries_proc
uncommented. It worked fine at that point.
The threads definitely are dead by the time the irb
prompt appears. I assigned them to a global variable to check.
I'm unclear where the error is coming out. Is it buffered from the beginning? Or is something being re-imported?
Okay, this was interesting. I added NARF
to the load_libraries_proc
in addition to flushing stdout and stderr:
$ be irb
NARF0
NARF ["yaml"]
NARF ["method_locator"]NARF ["every_day_irb"]
NARF ["g"]
NARF ["zucker/debug"]
NARF ["ori"]
NARF ["ap"]
NARF ["fileutils", "interactive_editor", "sketches"]
NARF ["paint", "wirb", "fancy_irb"]
NARF ["wirb/wp"]NARF ["paint/pa"]Welcome to IRB. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]. Have fun ;)
NARF1
NARF ["looksee"]
NARF []
>> $stdout.flush #=> #<IO:<STDOUT>>
>> $stderr.flush #=> #<IO:<STDERR>>
>> Threads.list
NameError: uninitialized constant Object::Threads
from (irb):3
from /Users/docwhat/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'
>> Thread.list #=> [#<Thread:0x007fd52906b598 run>, #<Thread:0x007fd5299d31a8 sleep>]
>> Thread.list[1] #=> #<Thread:0x007fd5299d31a8 sleep>
>> $narf0
NARF ["hir#=> #<Thread:0x007fd529312148 dead>
>> $narf1 #=> #<Thread:0x007fd5299d30e0 dead>
>> Thread.list[1] #=> nil
>> Thread.list #=> [#<Thread:0x007fd52906b598 run>]
>> exit
I don't know where that forth thread came from: 0x007fd5299d31a8
It was sleeping. I have a suspicion that it might be part of the problem....hanging around for a while and then trying to run as ruby is exiting....
This makes sense since ruby 1.9 uses native threads and they work in a less deterministic ways than the the green threads in 1.8.
Hopefully this helps. If not, please ignore.
Thanks for your efforts. Cannot figure it out, yet. But do i understand you right: Everything else works (only throws errors when exitting)? If so, I'd still release and look at it sometimes later...
I've been seeing this issue with hirb every now and again as well. Sometimes when I exit it throws an error, sometimes it doesn't. I'm on irbtools-more 1.2.0.
I'm getting this intermittently as well with irbtools 1.2.0, with the irbtools-more module loaded. Haven't tried it without the module.The error generally looks like:
Couldn't load the irb library 'boson': NoMethodError
* undefined method `start' for Boson:Module
* /Users/jrhorn424/.rvm/gems/ruby-1.9.2-p290@railstut/gems/irbtools-1.2.0/lib/irbtools/libraries.rb:172:in `block in <top (required)>'
Requiring boson in my .irbrc doesn't help.
Update: More information:
I'm using ruby 1.9.2 with rails 3.2.2. I haven't used irb much, but this happens in the rails console.
Moving to Ruby 1.9.3 triggers this error when I start rails console.
My irbrc:
require 'rubygems' unless defined? Gem # rubygems is only needed in 1.8
# IRB tools
require 'irbtools'
require 'irbtools/configure'
Irbtools.add_package :more
Irbtools.start
load File.dirname(__FILE__) + '/.railsrc' if $0 == 'irb' && ENV['RAILS_ENV']
My .railsrc is verbatim from this post.
Here's a typical rails console session where the error occurs:
jrhorn424 at hook in ~/Learning/rails/rails-tutorial/sample_app on sign-up
$ rails console
Loading development environment (Rails 3.2.2)
Welcome to RAILS. You are using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.3.0]. Have fun ;)
>> user = User.find(5)
Couldn't load the irb library 'boson': NoMethodError
* undefined method `start' for Boson:Module
* /Users/jrhorn424/.rvm/gems/ruby-1.9.2-p290@railstut/gems/irbtools-1.2.0/lib/irbtools/libraries.rb:172:in `block in <top (required)>'
User Load (64.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 5]]
Hey @jrhorn424, try updating irbtools to 1.2.1
@janlelis Thanks. Sorry for the noise. I actually had "irbtools-more" in my Gemfile. The difference is a bit confusing. They're merged now, right?
Don't care about the noise ;).
No, it's not merged, -more has got some extra gems. Its version number is loosely related to irbtools'
Hi
rails console produces:
undefined method `start' for Boson:Module
Installed irbtools as follows:
gem install irbtools . . . Successfully installed zucker-12.1 Successfully installed boson-1.2.4 Successfully installed clipboard-1.0.1 Successfully installed spoon-0.0.1 Successfully installed interactive_editor-0.0.10 Successfully installed every_day_irb-1.4.0 Successfully installed paint-0.8.5 Successfully installed unicode-display_width-0.1.1 Successfully installed fancy_irb-0.7.3 Successfully installed wirb-1.0.1 Successfully installed hirb-0.7.1 Successfully installed awesome_print-1.0.2 Successfully installed g-1.7.2 Successfully installed ori-0.1.0 Successfully installed methodfinder-1.2.5 Successfully installed method_locator-0.0.4 Successfully installed irbtools-1.4.0
irb is fine.
Welcome to IRB. You are using ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux]. Have fun ;)
rails console produces the boson error above
rails -v Rails 3.2.12
My ~/.irbrc file is:
!/usr/bin/env ruby
require 'hirb' require 'boson' require 'irbtools'
Noting the comments above, I've tried it with requiring hirb & boson first and then requiring irbtools (as in the irbrc example above) and also just requiring irbtools. Same result.
Let me know if you need more information.
Ross
I'm sure this isn't an irbtools bug, but rather in a package in irbtools....
I'm getting this error:
I couldn't figure out how to get more information out of irb, so I don't know what's causing it...
My
.irbrc
:Here are the gems I have installed: