WEIRD: hpricot causes Error 500

So this is weird. I have this in one of my controllers:

    f = open("http://www.google.com")    @s = f.read

And that's fine. I can echo @s back out in the view, and it works like a charm. But the second I do this (in the controller):

    doc = Hpricot(@s)

I get an error 500 (internal server error). I have rubygems, open-uri, and hpricot all included. Any ideas what's going on? I'm under a pressing deadline and this one's really got me stumped.

Thanks in advance!!!

Quoting jason <jason.w.victor@gmail.com>:

So this is weird. I have this in one of my controllers:

    f = open("http://www.google.com")    @s = f.read

And that's fine. I can echo @s back out in the view, and it works like a charm. But the second I do this (in the controller):

    doc = Hpricot(@s)

I get an error 500 (internal server error). I have rubygems, open-uri, and hpricot all included. Any ideas what's going on? I'm under a pressing deadline and this one's really got me stumped.

Look in the log, there is usually a stack dump. Are you sure that the entire datastructure is in @s? I.e., that the end of the HTML/XML is in the string. Also there can be parsing errors, encoding errors, etc. So find the error message/exception type in logs, or catch (rescue) it in your own code.

Jeffrey