[MacRuby] #1218: Mechanize fails under MacRuby, runs under 1.9.2 (similar to ticket #1182)
#1218: Mechanize fails under MacRuby, runs under 1.9.2 (similar to ticket #1182) ------------------------------+--------------------------------------------- Reporter: lonny6@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- "undefined method 'html_parser' for nil:NilClass" Please see the attached text. It shows the mechanize gem working under Irb in Ruby 1.9.2, and the same failing under MacIrb from MacRuby 0.10. The gems in the 2 environments are identical. I don't think the problem is what dekiefer (#1182) thought it is. In the uploaded text you can clearly see that Mechanize.new() is not working properly under MacRuby. An instance does appear to get created, but it is not properly initialized. In contrast, under 1.9.2, you can see that the mechanize object is fully populated with attributes, including "@html_parser". This also happens in the situation mentioned in ticket #1182, but I don't think anybody noticed. I doubt it has anything at all to do with prettyprint. Regardless: I have no idea why the mechanize object is not getting properly initialized in MacRuby. This is a blocking issue for me. I have a project that must go forward and this is stopping me. Any advice on how to patch this problem would be appreciated, as it is urgent. I should also mention that the same error occurs under XCode, but that should not be a big surprise because it's using the same MacRuby. -- Ticket URL: <http://www.macruby.org/trac/ticket/1218> MacRuby <http://macruby.org/>
#1218: Mechanize fails under MacRuby, runs under 1.9.2 (similar to ticket #1182) ------------------------------+--------------------------------------------- Reporter: lonny6@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- Comment(by lonny6@…): Later note: I thought my deduction was sound (since the full Mechanize instance does not seem to be returned when it is created), but I discovered this morning that if I include "puts agent.inspect" in the code right after creation, the full object gets printed out. Also, "puts agent.html_parser" returns "Nokogiri::HTML" just as I would expect. So it DOESN'T actually appear to be a problem in the initialization of the object after all (though it is weird that the whole object does not get returned at first). But somewhere in the code, the Mechanize object is showing up as nil. -- Ticket URL: <http://www.macruby.org/trac/ticket/1218#comment:1> MacRuby <http://macruby.org/>
#1218: Mechanize fails under MacRuby, runs under 1.9.2 (similar to ticket #1182) ------------------------------+--------------------------------------------- Reporter: lonny6@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- Comment(by lonny6@…): I did find a way to patch this file that works for my purposes. I do not pretend that it addresses the underlying problem. After line 565 of mechanize.rb (v 1.0.0), which reads page = options[:page] add the following line: page.mech = options[:agent] if page.is_a?(Mechanize::Page) It appears that the "mech" attribute of the page object is not getting set for some reason. So if I set it manually at that point, the library works fine... again, for my purposes. I do not claim this is a general fix. -- Ticket URL: <http://www.macruby.org/trac/ticket/1218#comment:2> MacRuby <http://macruby.org/>
#1218: Mechanize fails under MacRuby, runs under 1.9.2 (similar to ticket #1182) ------------------------------+--------------------------------------------- Reporter: lonny6@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- Comment(by james@…): I was able to get Mechanize running see #1257 -- Ticket URL: <http://www.macruby.org/trac/ticket/1218#comment:3> MacRuby <http://macruby.org/>
#1218: Mechanize fails under MacRuby, runs under 1.9.2 (similar to ticket #1182) ------------------------------+--------------------------------------------- Reporter: lonny6@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- Comment(by lonny6@…): That may be the ultimate reason why it wasn't working. I did get it working, but only via a patch that got it working for my specific purposes. I do not pretend that my patch was a general fix... without your patch it may have continued to fail in other areas that I was not using. -- Ticket URL: <http://www.macruby.org/trac/ticket/1218#comment:4> MacRuby <http://macruby.org/>
#1218: Mechanize fails under MacRuby, runs under 1.9.2 (similar to ticket #1182) ------------------------------+--------------------------------------------- Reporter: lonny6@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: | ------------------------------+--------------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.11 Comment: A fix has been committed, please check out tonight's nightly build and let us know if you still see a problem, in this case we will reopen the ticket and continue to investigate. Thanks! -- Ticket URL: <http://www.macruby.org/trac/ticket/1218#comment:5> MacRuby <http://macruby.org/>
#1218: Mechanize fails under MacRuby, runs under 1.9.2 (similar to ticket #1182) ------------------------------+--------------------------------------------- Reporter: lonny6@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: | ------------------------------+--------------------------------------------- Comment(by michaelreye01@…): It is complete new toping to learn today.I gain lot of information in through this site. TO know more about our site visit :[http://bestseoservicescompany.com/ Link Building Company] -- Ticket URL: <http://www.macruby.org/trac/ticket/1218#comment:6> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby