[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Color Parser

Mary Dixon

11/8/2004 11:01:00 PM

Okay, people,

I know almost nothing about Ruby, unfortunately. But I do know that I want
my color parser to work for me. This is what I've been doing in the
terminal:

sawtooth:~ marydixon$ ruby /Users/marydixon/Documents/businessdocs/htmlcolors.rb

HTML Color Table Generator
version 0.0.1
by W. Kent Starr (C)2002 SpiderwomanWebDesign.com
-------------------------------------------------

File or directory to process: /Users/marydixon/Desktop/style.css
Name of output file [colortable.html]:
Title of color table [Color Table for /Users/marydixon/Desktop/style.css ]:
Page background color [white]:
Page foreground color [navy]:

Press [ENTER] to begin
/Users/marydixon/Documents/business docs/htmlcolors.rb:213:in `initialize':
No such file or directory - "/Users/marydixon/Desktop/style.css "
(Errno::ENOENT)
from /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in
`new'
from /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in
`scanFile'
from /Users/marydixon/Documents/business docs/htmlcolors.rb:294:in
`process'
from /Users/marydixon/Documents/business docs/htmlcolors.rb:376
sawtooth:~ marydixon$


As you can see, I get a short list of errors although it seems other things
about it work just fine. I'm trying to extract color codes from a HUGE style
sheet so I can easily make changes to it where I want to. But this color
parser is making it difficult and my lack of knowledge about why I get these
errors is out of my realm of expertise.

Eventually, I would like to create a GUI for this to make it happen a lot
slicker and return the work to the community. Any help with any of these
things would be more than appreciated especially in memory of the original
creator.

Thanks...

Mary Dixon




3 Answers

Esteban Manchado Velázquez

11/8/2004 11:12:00 PM

0

On Tue, Nov 09, 2004 at 08:01:05AM +0900, Mary Dixon wrote:
> Okay, people,
>
> I know almost nothing about Ruby, unfortunately. But I do know that I want
> my color parser to work for me. This is what I've been doing in the
> terminal:
>
> sawtooth:~ marydixon$ ruby /Users/marydixon/Documents/business> docs/htmlcolors.rb
>
> HTML Color Table Generator
> version 0.0.1
> by W. Kent Starr (C)2002 SpiderwomanWebDesign.com
> -------------------------------------------------
>
> File or directory to process: /Users/marydixon/Desktop/style.css
> Name of output file [colortable.html]:
> Title of color table [Color Table for /Users/marydixon/Desktop/style.css ]:
> Page background color [white]:
> Page foreground color [navy]:
>
> Press [ENTER] to begin
> /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in `initialize':
> No such file or directory - "/Users/marydixon/Desktop/style.css "
^^^

It seems you have a space after the filename. That's probably the problem.
If it doesn't work after fixing that and you get stuck, please send (if
possible) the source code (or, at least, the relevant parts), so we can
examine and run it.

> (Errno::ENOENT)
> from /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in
> `new'
> from /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in
> `scanFile'
> from /Users/marydixon/Documents/business docs/htmlcolors.rb:294:in
> `process'
> from /Users/marydixon/Documents/business docs/htmlcolors.rb:376
> sawtooth:~ marydixon$

> As you can see, I get a short list of errors although it seems other things
> about it work just fine.

Look carefully: it's just one error, but in the form of "stack trace".
This way, you get both the error (first line) and the calling chain.

Good luck. Regards,

--
Esteban Manchado Velázquez <zoso@foton.es> - http://ww...
EuropeSwPatentFree - http://EuropeSwPatentFree.his...

Dave Burt

11/9/2004 1:59:00 AM

0


"Mary Dixon" <sw@swwd.net> wrote...
> /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in
> `initialize':
> No such file or directory - "/Users/marydixon/Desktop/style.css "
> (Errno::ENOENT)
> from /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in
> `new'
> from /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in
> `scanFile'
> from /Users/marydixon/Documents/business docs/htmlcolors.rb:294:in
> `process'
> from /Users/marydixon/Documents/business docs/htmlcolors.rb:376
> sawtooth:~ marydixon$
>
>
> As you can see, I get a short list of errors although it seems other
> things
> about it work just fine. ...

As Esteban said, it's not a list of errors, it's one error and its "stack"
including all the methods and blocks that are currently executing.

The error itself, at the top, is Errno::ENOENT, aka "No such file or
directory".

I'd be guessing that you're doing something like:
File.new("/Users/marydixon/Desktop/style.css ")
on line 213. Watch your whitespace - .strip it, .chomp it.

Cheers,
Dave


Mary Dixon

11/9/2004 5:41:00 AM

0

Being totally ignorant of that sort of thing, I didn't really see the space
until it was pointed out to me. I removed that and had a working script! I
was so excited about it. The remaining problem now seems to be that once I
run it and it works, it puts the resulting HTML file in a place that I can't
always find too easily. I guess I kinda need to dig a bit more.

The source is on rubyforge.org, incidentally, and can be found here:
http://rubyforge.org/projects/co...

There are further developments I'd like to see such as improved output and
perhaps a better way to get it to run and maybe someday a GUI.

Thanks everyone.....

Mary


On 11/8/04 6:12 PM, "Esteban Manchado Velázquez" <zoso@foton.es> wrote:

> On Tue, Nov 09, 2004 at 08:01:05AM +0900, Mary Dixon wrote:
>> Okay, people,
>>
>> I know almost nothing about Ruby, unfortunately. But I do know that I want
>> my color parser to work for me. This is what I've been doing in the
>> terminal:
>>
>> sawtooth:~ marydixon$ ruby /Users/marydixon/Documents/business>> docs/htmlcolors.rb
>>
>> HTML Color Table Generator
>> version 0.0.1
>> by W. Kent Starr (C)2002 SpiderwomanWebDesign.com
>> -------------------------------------------------
>>
>> File or directory to process: /Users/marydixon/Desktop/style.css
>> Name of output file [colortable.html]:
>> Title of color table [Color Table for /Users/marydixon/Desktop/style.css ]:
>> Page background color [white]:
>> Page foreground color [navy]:
>>
>> Press [ENTER] to begin
>> /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in `initialize':
>> No such file or directory - "/Users/marydixon/Desktop/style.css "
> ^^^
>
> It seems you have a space after the filename. That's probably the problem.
> If it doesn't work after fixing that and you get stuck, please send (if
> possible) the source code (or, at least, the relevant parts), so we can
> examine and run it.
>
>> (Errno::ENOENT)
>> from /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in
>> `new'
>> from /Users/marydixon/Documents/business docs/htmlcolors.rb:213:in
>> `scanFile'
>> from /Users/marydixon/Documents/business docs/htmlcolors.rb:294:in
>> `process'
>> from /Users/marydixon/Documents/business docs/htmlcolors.rb:376
>> sawtooth:~ marydixon$
>
>> As you can see, I get a short list of errors although it seems other things
>> about it work just fine.
>
> Look carefully: it's just one error, but in the form of "stack trace".
> This way, you get both the error (first line) and the calling chain.
>
> Good luck. Regards,