From: fabsy Date: 2006-08-19T02:55:06+09:00 Subject: Re: hpricot Chris Gehlker skrev: > On Aug 18, 2006, at 8:00 AM, fabsy wrote: > > > > > Chris Gehlker skrev: > > > >> On Aug 18, 2006, at 7:00 AM, fabsy wrote: > >> > >>> Hey.. I just installed hpricot but it acts strange.. > >>> I tried an example from > >>> http://code.whytheluckystiff.net/hpricot/wiki/HpricotBasics but it > >>> didn't work.. It just gave me "test.rb:1: parse error, unexpected > >>> tIDENTIFIER, expecting $"... > >> > >> Maybe you better show us your actual code. There are several examples > >> on that page. > >> > >> Look at this: > >> > >> require 'rubygems' > >> require 'hpricot' > >> require 'open-uri' > >> doc = Hpricot(open("http://qwantz.com/")) > >> (doc/"p/a/img").each do |img| > >> puts img.attributes['class'] > >> end > >> > >> It works although it doesn't actually find and image with a 'class' > >> attribute. > >> > >> > >> -- > >> Seven Deadly Sins? I thought it was a to-do list! > > > > Im getting the same error with the code you pasted.. > > Weird, > > I'm running ruby 1.8.5 (2006-08-18) [powerpc-darwin8.7.0] with > Hpricot 0.4.43 and I just cut and pasted the above code. It still > works. I'm stumped. > > --- > Conscience is thoroughly well-bred and soon leaves off talking to > those who do not wish to hear it. > -Samuel Butler, writer (1835-1902) I'ts really strange.. It works in irb but not when im pasting in in a .rb file.. Maby I should re-install it?